NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Steedvlx600
Jun 29, 2016Luminary
Best method to flatten folder hierarchy (6.5.1)
Looking for an efficient method for moving all files from all subfolders to the root of the parent folder... Pulling hair out. This should be more do-able than it has turned out to be. (Can't believe these things have no file manager built in to the system)
Example:
MasterFolder (before flattening)
- SubfolderA
- File1
- File2
- File3
MasterFolder (after flattening)
- SubfolderA (now empty)
- File1
- File2
- File3
ANY assistance greatly appreciated.
Finally found it!
Command Prompt (Admin mode)
Use
PUSHD (to map the network share to a logical drive letter)
Then
CD into the directory you want to flatten into itself
Then
run the command
for /r %f in (*) do @move "%f" .
which will move all of the subfolder contents into the base folder from which the command was executed. (prompts for overwriting duplicate file names cannot be avoided)
sort the explorer window by "type", and you can cull out the unwanted stuff (as well as the empty directories) to leave ... data files.... JUST the data files..
Whew! That was fun! I hope this information is helpful to someone else out there.
8 Replies
Replies have been turned off for this discussion
- StephenBGuru - Experienced User
You can do it reasonably efficiently from Windows - if you open two file explorer windows for the same share, Windows should do a move and not a copy/delete.
- Steedvlx600Luminary
Thank you. But, I was thinking of something a little less labor-intensive.
We are talking about hundreds of subfolders with several files and even more subfolders, with even more files in each.
Going through each and every one would take hours, if not days.
I do have one windows laptop that I could use. does the command prompt offer any hope? (Mac terminal geek here. but, mac terminal will not run file operations on the NAS share for some reason.)Thank you for taking the time to respond.
- StephenBGuru - Experienced User
I'm not a mac guy. With Windows you can simply search for * in one folder, then select all, and move to the other. It won't take days.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!