New
#1
batch file that searches for files from list - multiple copies ???
HI.
I use the following batch files to search through folders for images listed in a text filelist and copy them to destination folder.
set FIILELIST=FileList.txt
set SEARCHFOLDER=%cd%\Overlaid-Images
set FILEDESTINATION=%cd%\FilesCategorised\Category01
IF NOT EXIST %FILEDESTINATION% (mkdir %FILEDESTINATION%)
for /f "delims=" %%x in (%FIILELIST%) do (forfiles /p %SEARCHFOLDER% /s /m %%x /c "cmd /c copy /y @Path %FILEDESTINATION%\@file" 2>>temporary_log.txt)
for /f "tokens=5 " %i in (temporary_log.txt) do (echo.%~i)>>temporary_log.txt
del temporary_log.txt
pause
REM %%x.* for files without extensions and %%x for files with.
Sample FileList.txt:
ai21091458-ai21ndnl-GS
ai21091458-ai21ndnl-GS
ai21091458-ai21ndnl-GS
ai21092313-ai21tjxq-GS
ai21092338-ai21skue-GS
ai21092703-ai21rfcx-GS
ai21092234-ai21cvjq-GS
ai21092418-ai21ifxs-GS
ai21092438-ai21ifxs-GS
It works superbly for my needs with one exception. It doesn't create multiple copies if there is more than one identical entry.
So, I was wondering if the following is possible?:
If the script encounters the same filename entry in the FileList.txt more than once, can a script make as many copies of that file as are in the list rather than just the one, as currently?
|For example, in the sample FileList.txt list above, rather that create one copy of 'ai21091458-ai21ndnl-GS', can a script create three copies of it for me?
I don't think this is possible, but better to ask.
Thanks to anybody who might be able to help me.