I have a list of files in a file called FileList.txt
. The are about 120 files in this text file all ending with the same suffix .fastq.gz
. An example of the first 6 rows of text:
sample1_R1.fastq.gz
sample1_R2.fastq.gz
sample2_R1.fastq.gz
sample2_R2.fastq.gz
sample3_R1.fastq.gz
sample3_R2.fastq.gz
These files live within
the following folder structure: Completed_files\testcomplete_041323\041323
. The last part of the last folder where the files live is the date (MMDDYY). The layer of complexity is that the files live in different-dated folders (i.e., 4 files from FileList.txt live in testcomplete_041323\041323
, 6 files live in testcomplete_040523\040523
and so on...). I need a Windows batch file that copies all of the files from FileList.txt
into a different directory. Here is the current batch script I have:
@ECHO off
SET FileListTxt=FileList.txt
SET SourceFolder="testcomplete*"
SET DestinationFolder="out_folder"
for /f "tokens=* delims=" %%a in ('type "%FileListTxt%"') do robocopy "%SourceFolder%" "%DestinationFolder%" "%%a"
ECHO DONE COPYING FILES IN %FileListTxt% FROM %SourceFolder% TO %DestinationFolder%
I put FileList.txt
and this batch script in Completed_files
and ran the script. The issue I am observing with this code is that it is creating empty DIRECTORIES named with each of these files and not copying the files themselves.