How do I go about running a batch script from the top level folder, which will find all .bak files in each subfolder and then move those .bak files into a "backup" subfolder inside each of those folders? (The "backup" subfolder may or may not already exist)
I've been using this script to copy files recursively into subfolders, but when I change 'copy' to 'move' I get "The syntax of the command is incorrect"
Code: Select all
for /f "delims=" %%a in ( ' dir "*.bak" /b /s /a-d ' ) do (
echo processing "%%a"
copy /b /y "%%a" ".\backup\!name:~0!"
Not quite sure how to proceed here...