I have a main folder that houses subfolders for each CNC job that is created by some CNC software we're using:
I:\MI-CNC\Backup_IMC\CNC_JOBS
For each CNC job, the software creates a job folder and places a text file (label.txt) in a "Labels" subfolder:
I:\MI-CNC\Backup_IMC\CNC_JOBS\XA049_ATA_PLASTIC\Labels\label.txt
I'm trying to figure out how to find and copy all of those individual label.txt files matching that folder path pattern in each job folder out to a collective "labels" folder, but renaming them to the job folder name.
So, using the job folder shown above, the logical process would be:
1) Find the label.txt file in the I:\MI-CNC\Backup_IMC\CNC_JOBS\XA049_ATA_PLASTIC\Labels folder
2) Copy it to I:\MI-CNC\Labels with the name XA049_ATA_PLASTIC.txt.
3) Repeat Step 1 on the next Job folder until complete.
The closest code I've come up with so far is this:
Code: Select all
@ECHO OFF
I:
CD MI-CNC\Backup_IMC\CNC_JOBS
for /r /d %%F in (labels\label.txt) do @for %%A in ("%%F\..\..") do copy %%F I:\MI-CNC\Labels\%%~nxA.txt
Is there a way to force the operation to only use the CNC_JOB\[job name]\Labels\label.txt path?
Thanks for any insight!
TVB