SO I’ve got a directory with a long list of files, each with a naming structure that relates to what’s inside the file. I need to find and pull a specific file, copying it to a transfer folder, so I can work on it, while preserving the original file. This is all fine when I have a small number of files to search for, but is there a way to do this with a list of 100’s of files?
I’m thinking have the list of search names saved as a .txt or .csv file on the transfer folder, then run a batch script that searches through and searches the data file directory and when it finds a match, copies the data file, and moves on, until the end.
Any help?
REM @ECHO OFF
:creates backup folder
IF NOT EXIST C:TRANSFERSEARCH_RESULTS MD C:TRANSFERBACKUP_LOTS:grabs the date and time and makes a folder name
for /f “tokens=2-8 delims=:-. ” %%A in (‘NOW’) do set BACKUPDIR=%%A%%B%%C-%%D%%E:Makes the timestamped directory.
MD C:TRANSFERBACKUP_LOTS%BACKUPDIR%REM SETLOCAL
:defines variable name
SET LOCAL_LOTS=C:TRANSFERBACKUP_LOTS%BACKUPDIR%:search name list
_____?:copies from the data folder to the timestamped transfer folder
COPY C:DATA_FOLDER*.DAT %LOCAL_RECIPES%:repeat until end of name list
_______?REM PAUSE