search - copy problem
Posted: 09 May 2019 08:11
Hello!
I get a Text-file from an system - in this file there are filenames (per line one filename) - now with a batch-file every line (filename) from this list should be searched in a directory and copied in an other direcory.
I have this found and it almost works:
This works if the list lokks like this:
filename1
filename2
....
BUT from the other system i get the list like this:
filename1;
filename2;
....
OR I can also change it to this:
"filename1"
"filename2"
....
Can someone help me please with this?
I get a Text-file from an system - in this file there are filenames (per line one filename) - now with a batch-file every line (filename) from this list should be searched in a directory and copied in an other direcory.
I have this found and it almost works:
Code: Select all
@echo off &setlocal
set "sourceRoot=C:\Users\test\Desktop\COPY_TEST\originale"
set "sourceList=C:\Users\test\Desktop\COPY_TEST\DBLIST.TXT"
set "destFolder=C:\Users\test\Desktop\COPY_TEST\kopiert"
for /f "delim=" %%i in ('dir /a-d /b /s "%sourceRoot%\*.pdf"^|findstr /ig:"%sourceList%"') do (
copy "%%~i" "%destFolder%\"
)
ECHO "Ausgabe abgeschlossen"
PAUSE
filename1
filename2
....
BUT from the other system i get the list like this:
filename1;
filename2;
....
OR I can also change it to this:
"filename1"
"filename2"
....
Can someone help me please with this?