I want to copy a set of subfolders where name contains
items on a list. The list has a set of codes (e.g. ABC1
, ABC2
) but the folders are named ABC1_revised_2018
, etc. My batch file I put together is below. What I am getting a '"Usebackq tokens=^" was unexpected'
error.
@ECHO ON
SET FileList=C:\filelist.txt
SET Source=C:\Files
SET Destination=C:\Files-Parsed
FOR /D "USEBACKQ TOKENS=^" %%D IN ("%FileList%") DO XCOPY /E /F /D "%Source%\%%~D" "%Destination%\"
GOTO :EOF
I am attempting to use ^
to denote match beginning of string
but that clearly isn't working. Any ideas? I have tried with a batch file and also line by line in cmd.
append
Folder
-ABC1-text-date (this is a subfolder)
-ABC2-text-date
filelist.txt only has values like ABC1, ABC2, etc. not exact matches does this help?