|
Answer» I GOT the following code:
Code: [Select]for /f "tokens=*" %%c in ('dir "C:\Source FOLDER" /a:-d /s /B') do MOVE /y "%%c" "C:\Destination folder"
rd /s /q "C:\Source folder"
It empties all files from the Source folder as well as its sub folders. It then deletes the Source folder and its remaining subs.
How can I tell it to create the destination folder if it doesn't already exist prior to moving the files?
Code: [Select]if not exist "C:\Destination folder" md "C:\Destination folder"Right, but where in that first line would I put it?You would put it before the first line, which will now be the second line. Right... Stupid me...
I was THINKING it needed to be in the middle somewhere since the code had already grabbed the files out of their folders...If you want to move a file from folder A to folder B, it is necessary to first ensure that folder B exists. Before you even start.Yeah, brain fart on my part I suppose...
In my defense, I copy/pasted the code from elsewhere...
|