× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Best method to flatten folder hierarchy (6.5.1)

Steedvlx600
Luminary

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.

Model: RN31600|ReadyNAS 300 Series 6- Bay
Message 1 of 9

Accepted Solutions
Steedvlx600
Luminary

Re: Best method to flatten folder hierarchy (6.5.1)

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.

 

 

View solution in original post

Message 6 of 9

All Replies
StephenB
Guru

Re: Best method to flatten folder hierarchy (6.5.1)

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.

Message 2 of 9
Steedvlx600
Luminary

Re: Best method to flatten folder hierarchy (6.5.1)

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.

 

Message 3 of 9
StephenB
Guru

Re: Best method to flatten folder hierarchy (6.5.1)

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.

Message 4 of 9
Steedvlx600
Luminary

Re: Best method to flatten folder hierarchy (6.5.1)

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.

 

 

Message 5 of 9
Steedvlx600
Luminary

Re: Best method to flatten folder hierarchy (6.5.1)

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.

 

 

Message 6 of 9
StephenB
Guru

Re: Best method to flatten folder hierarchy (6.5.1)


@Steedvlx600 wrote:

 

 If I am misunderstanding your suggestion, I apologize. But, one at a time is not a viable option.

 

 

You were misunderstanding.  My suggestion would have listed all the files in the tree in the single search window (since * is the wildcard), then you would have been able to select them all at once and move them to the parent folder.

 

However, you found your own solution.

Message 7 of 9
Steedvlx600
Luminary

Re: Best method to flatten folder hierarchy (6.5.1)

Sorry for not getting it the first time... Thank you for your assistance.

 

 

Message 8 of 9
BrianL2
NETGEAR Employee Retired

Re: Best method to flatten folder hierarchy (6.5.1)

Hi Steedvlx600,

 

We appreciate your feedback and for letting us know how you resolved your issue Kindly mark this thread closed by clicking "Accepted as Solution” button in one of the responses that you received so others can benefit from your solution. We also look forward to hearing more from you and being a helpful resource in the future!

 

 

Kind regards,

 

BrianL
NETGEAR Community Team

Message 9 of 9
Top Contributors
Discussion stats
  • 8 replies
  • 3533 views
  • 1 kudo
  • 3 in conversation
Announcements