Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.


CNET Support

General discussion

Move folders up one level?

Dec 11, 2010 6:22AM PST

So the situation i have is like this. I have a folder hierarchy that looks like:


And I want it to look like:


basically just move the immediate subfolder in each folder up one level. There are hundreds of these in FOLDER and need them all moved like this without messing up the rest of the structure. Just need to take out "Name" pretty much.

Anyone know of an easy way to do this (not manually) or a program or something? I have found many programs that will pull the files up a level but I need the folder structure to remain the same and not just bring the files up.

I feel like this description is kind of confusing but its the best I could do. Thanks.

Discussion is locked

- Collapse -
Re: moving folders
Dec 11, 2010 6:51AM PST

Manually (in Explorer) it's two operations for each name (select all folders in the right pane and move to FOLDER; then delete Name. It might make sense to work with an intermediate folder to move to, to prevent confusion between folders that have been moved already (old Folders) and folders that still should be moved (old Names). For 100 Names I'd say it's done in less than an hour.

If you don't want to do it manually, write a vbscript using the filesystem object. It's a powerful technique but it might take you a night or two to grasp it, depending on your programming compentencies.


- Collapse -
Dec 11, 2010 7:17AM PST

Yeah I'm really not too good with VB. Had one class back in High School and don't remember much. There are over 300 of these folders to move and it's really going to be a pain to do it manually. Is there something simple like a script that I could use? I was thinking using something like coping from FOLDER/*/* to somewhere else so it takes all "Folders" but I'm not even sure if you can use wildcards like that or where to start on writing something that would do that. Thanks anyway.

- Collapse -
Dec 11, 2010 9:42AM PST

After over an hour of sifting through directories and manually moving each one, the deed is done. Man that was harsh. Would still like to know if there was an easier way that I would understand how to do for future reference.

- Collapse -
I can think of a fairly easy way
Dec 12, 2010 3:06AM PST

Your example -

And I want it to look like:


I would suggest you make use of XCOPY and the command -
xcopy "C:\FOLDER\Name\*.*" "C:\FOLDER\" /D/E/R/K/Y

That copies the full tree ..\folders\files up under FOLDER and after you verify that everything copied to where you want it you make use of the command - rd FOLDER\Name /s which removes the ..\Name\ directory and all files and subdirectories within it.

The initial xcopy command as shown DOES NOT copy any files within the Name directory so if there are files within that directory you want copied adjust the command. The second command removes the Name Directory and all files and subdirectories within it so if you want the Name directory to remain adjust the command.

This link might prove helpful -

- Collapse -
Dec 11, 2010 10:03PM PST

There are alternatives, but they involve a lot of DIY. What I thought of this morning:
1. Dir of FOLDER to make a file of all Names (each Name a new line).
2. Use your favorite editor change each line in a copy command to FOLDERNEW, like
xcopy Name/*.* Foldernew /s (can be done in Notepad, a macro in Word or with one command using sed)
3. Execute the batchfile you made in step 2.