Okay first let me say thank you, I'd been hoping you'd show up here as I've seen your work and had a feeling you were the guy for the job.
It was/is really close in that it did move all the files, but it didn't move any of the folders that were in the Student\ directories. It instead looped and created a documents folder inside of all the sub directories and moved the contents into them.
Ah yes, forgot that case
The structure you gave above, the \Student xxx
, is that the literal structure or figurative?
ie. Is it really \Student 123
or was that just a way of describing the structure?
If it's the first case, then if you change:
for /f "usebackq tokens=*" %%a in (`dir /s /b /ad *.*`) do (call :MakeMove "%%a")
for /f "usebackq tokens=*" %%a in (`dir /s /b /ad Student*`) do (call :MakeMove "%%a")
That'll list only the folders with Student in them and stop the creation of Documents in the sub-folders.
I've changed the move
because move didn't handle folders, besides which robocopy will do a verified copy before deleting the original.
Modified original command file.
4wd, isn't this recursive?
move "%~1\*.*" "%~1\Documents\"
Since "%~1\*.*" includes Documents already.
Didn't seem to be since the move command just ignores folders, which is what SJ mentioned. I've switched to robocopy since it does it all in one hit and I can exclude the destination folder from the move.
I would try it this way...
Certainly a better way to create the folders since it takes into consideration non-uniform sub-dir names - might have to rejig that bit later
Using robocopy obviated the need for recursive move commands ... I hope ... seems to work OK with my test structure.
Addendum: The shorter version using some of Abterix' lines:
All versions are up there
As before, try it on nuke-friendly structure first.
Modified my first post to add this version.