I have a utility using xcopy excludes some folder or files. The plan is to display each folder and ask if you would like to exclude it from the backup.
This is as far as I could get;
for %%f in ("%userprofile%\Documents\*") do (
choice /c yn /m "Exclude Folder [%%~dpnxf]? "
if errorlevel 2 (
echo ... skipped
) else (
echo "%%~ff">>%~dp0exclude.txt
)
)
How do I display only the subfolder's name in My Documents without the path (My Video, My Music, etc.)
How do I display only the files names in My Documents.
Thanks to whomever I got this bit of code from.
I appreciate the help!
Browse folder names only no path and put in text file
Moderator: DosItHelp
-
- Posts: 20
- Joined: 25 May 2012 12:34
Re: Browse folder names only no path and put in text file
This may give you an idea.
Code: Select all
For /D %%f In (%UserProfile%\Documents\*) Do Echo("Exclude Folder [%%~nxf]? "
Last edited by Compo on 01 Feb 2015 16:17, edited 1 time in total.
-
- Posts: 20
- Joined: 25 May 2012 12:34
Re: Browse folder names only no path and put in text file
Thanks but that just posted "Exclude folder [%%~nxA]
-
- Posts: 20
- Joined: 25 May 2012 12:34
Re: Browse folder names only no path and put in text file
I figured it out! This gives me only the Folder name (no path) and saves it to a text file for later use.
for /f "tokens=*" %%i in ('dir "%userprofile%\Documents\" /ad /b') do (
choice /c yn /m "Exclude Folder [%%i]?
if errorlevel 2 else (
echo %%i>>%~dp0exclude.txt
)
)
for /f "tokens=*" %%i in ('dir "%userprofile%\Documents\" /ad /b') do (
choice /c yn /m "Exclude Folder [%%i]?
if errorlevel 2 else (
echo %%i>>%~dp0exclude.txt
)
)