I have a directory structures like so:
C:\mydir\foo\a.zip
C:\mydir\foo\b.zip
C:\mydir\bar\c.zip
C:\mydir\baz\d.zip
I would like to move all files in C:\mydir\*\*.zip to C:\mydir so the output structure would be:
C:\mydir\a.zip
C:\mydir\b.zip
C:\mydir\c.zip
C:\mydir\d.zip
…with the superfluous empty folders potentially still present. How do I accomplish this using only the DOS command-line?
Try this:
It first changes the directory to
C:\mydir. TheDIRlists all zip-files in subdirectories with filenames only. TheFORmakes sure each lines goes into the variable%a.MOVEbasically moves each file found into the current directory, i.e.C:\mydir.