General discussion

Move folders up one level?

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

FOLDER/Name/Folders/files.exe

And I want it to look like:

FOLDER/Folders/Files.exe

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

Follow
Reply to: Move folders up one level?
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: Move folders up one level?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Comments
- Collapse -
Re: moving folders

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.

Kees

- Collapse -
Thanks.

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 -
Done.

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

Your example -
FOLDER/Name/Folders/files.exe

And I want it to look like:

FOLDER/Folders/Files.exe


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 -
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

- Collapse -
Alternatives.

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.
4. Rename FOLDER to FOLDEROLD
5. Rename FOLDERNEW to FOLDER

Done.

CNET Forums

Forum Info