1

Within a master folder I have 1000 folders all individially named with a part number such as DGTS-9045. Within that folder are various sub-folders, one of which contains 24 jpeg images (used for html5 product rotation sequences)

How would I copy say 6 images, such as frames 1,5,9,13,17 and 21 from within each of those 1000 sub-folders and place them in another folder named the same as the original? All original folders are stored locally on pc, destination folders would need to be created through the script.

I tried for /d %1 in (*) do for %2 in (1,5,9,13,17, 21) do copy %1\photos\pic%2.jpg %1\newfolder but got The system cannot find the file specified

If the images are in subfolders of D:\Pictures\Client Name\2nd Batch, 21st March\Html 5 outputs and they are to be copied to folders in D:\Pictures\Selected what would the correct syntax be?

0

To see what might be a result of this nested for loops, try (copy and paste to command line and hit <Enter>)

for /d %g in (*) do @for %h in (1,5,9,13,17, 21) do @echo @copy %g\photos\pic%h.jpg %g\newfolder\

To get more info: try for /? and read more about for command, especially on recursing subfolders for /R.

Then you could get rid of @echo to run @copy commands for real...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.