Tuesday, 2 February 2010

Move files from sub-directory to root folder

Had a need to move a bunch of database backup files from sub-directories into a root folder so it was easier for my restore script to process them all. Came across this little gem and decided it really needed to go into my toolbox

for /f "tokens=5* skip=2" %i in ('dir *.bak ^| findstr "DIR"') do (move %i\*.* .)

No comments: