.bat script to sequentially move contents of subfolders to another directory

Viewed 17

Pulling my hair out with bat/cmd! I have looked through other answers but struggling to adapt what I've read.

My data looks like

C:/Batches/Batch1/csv1.csv
              .../csv2.csv
                  ...
       .../Batch2/...


There are multiple batches, and each batch contains multiple csv files.

I want to sequentially copy the csv files from each batch to another directory, (C:/run location/) and then make a call to external software.

In pseudo code

for each Batch in Batches:
   delete all csv files in 'C:/run location'
   copy csv files in Batch to 'C:/run location'
   call external software

.bat attempt:

for /f %%f in "C:\Batches\*" do (
    DEL "C:\run location\*.csv"
    MOVE "C:\Batches\%%f\*.csv" "C:\run location\"
    cd /d "C:\Program Files\software"
    software_cmd.exe "C:\software_project.xyz" 


)

(The call to software works ok and references the 'run location' internally - hence call should give different output after moving files.)

0 Answers
Related