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...
- Jun 29, 2016
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.
Steedvlx600
Jun 29, 2016Luminary
Sorry. I don't think I am making myself clear somehow.
I am showing over 1200 folders with multiple subfolders and files. It would be a monumental waste of time to do it one at a time.
I am familiar with the windows command prompt. And, there is a nifty command structure if it hasn't been deprecated...
for /r %f in (*) do copy "%f" .
This will accomplish what I want on local drives by walking through each folder and copying every file to the root folder. But, it apparently this will not work on NAS drives. I am looking for a solution like this, that will do all the heavy lifting on the NAS drive array.
If I am misunderstanding your suggestion, I apologize. But, one at a time is not a viable option.
Thank you for your response.
Steedvlx600
Jun 29, 2016Luminary
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.
Related Content
NETGEAR Academy

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