Link to home
Start Free TrialLog in
Avatar of SickBoy23
SickBoy23

asked on

MS DOS Batch File to Rename & Move Files from nested file structure

Hello,

I would like to modify the following code to recursively move files from c:\pictures to here c:\new pictures and rename them pre-fixed with their sub folder name, can anyone help?

Thanks

@echo off
 
setlocal
 
pushd "c:\pictures"
 
for /f "tokens=*" %%a in ('dir /b /a-d /s *.jpg') do copy "%%a" "c:\new pictures"
 
popd

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SickBoy23
SickBoy23

ASKER


Steve the code works great!! Appreciated!

Thanks

Steve, if I want to change the paths e.g. move & rename the contents of C:\Temp\NewFolder\Pics to here C:\Temp\NewFolder, how would I do this?

Thanks

Ignore the above figured it out, I was doing something stupid!