Hello,
I have a folder with over 4k recordings that I need to sort based on three parameters that are inside a CSV or a TXT file. All these parameters are part of the file name.
First, I need to select the files based on the Rec number, after that based on the date of recording and finally based on the test (verSacc, antisaccades, etc). Examples of some files names below.
I am aware that I need to iterate through all files three times and pinpoint the right column in the CSV each time, but I do not know if a batch will be the right call for this or maybe another type of script...
If you guys have experience with this, I would very much appreciate a response.
Warm regards,
Ovidiu
EVALAB_Stimuli_26 feb 2017_antisaccades_Rec 01.tsv
EVALAB_Stimuli_15 ian 2018_antisaccades_Rec 02.tsv
EVALAB_Stimuli_11iulie2018_verSacc_Rec 57.tsv
EVALAB_Stimuli_11iulie2018_verSacc_Rec 61.tsv
EVALAB_Stimuli_29iulie2018_verSacc_Rec 109.tsv
Move/copy files based on a list of requests
Moderator: DosItHelp
Re: Move/copy files based on a list of requests
Hi Ovisele,
It's probably feasible in Batch, but it'll be very hard.
I'd recommend that you use a more powerful language for that. (JScript, PowerShell, or Python)
If you really want to use Batch, and if you're sure the _ and . characters can never appear within one of the filename components, you can begin by extracting components this way:
It's probably feasible in Batch, but it'll be very hard.
I'd recommend that you use a more powerful language for that. (JScript, PowerShell, or Python)
If you really want to use Batch, and if you're sure the _ and . characters can never appear within one of the filename components, you can begin by extracting components this way:
Code: Select all
setlocal EnableExtensions EnableDelayedExpansion
for %%f in (EVALAB_*.tsv) do (
for /f "delims=._ tokens=3,4,5" %%a in ("%%~f") do (
set "FILEDATE=%%~a"
set "FILETYPE=%%~b"
set "RECNUM=%%~c"
)
rem Use the three variables using !expansion! here. Ex:
echo FILEDATE=!FILEDATE! FILETYPE=!FILETYPE! RECNUM=!RECNUM!
)
Re: Move/copy files based on a list of requests
Thank you very much! Will definitely try this!