Moving subdirectories one level up!

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
kokko
Junior Member
Junior Member
Posts: 4
Joined: 2005-07-08, 12:15 UTC

Moving subdirectories one level up!

Post by *kokko »

Dear Friends,
I use TC mainly on music workstation.
I was re-organizing my sample library and I found out that an old sample set has this problem: every sample folder is inside a folder with the same name as the sample folder. all those folders are inside the sampleset folder.... graphically:
[ORCHESTRA SOUND]
|
|__[Violins]
| |___[Violins]
| | |_ sample1.wav, sample2.wav etc etc
|
|__[Violas]
| |___[Violas]
| | |_sample56.wav, sample77.wav etc etc
|___[etc etc]


what i would like to do is move every sample folder one level upper, deleting the old "same-name"folders, which are unuseful, without doing it one by one(there are hundreds!)
I thought CTRL+B could help, but it can't as it doesn't show subdirs.
can someone help me?
Kokko
cptpicard
Junior Member
Junior Member
Posts: 31
Joined: 2005-08-25, 17:58 UTC

Post by *cptpicard »

Use "Custom Columns" -> [=tc.path].

Now you can see the subfolders.
kokko
Junior Member
Junior Member
Posts: 4
Joined: 2005-07-08, 12:15 UTC

Post by *kokko »

Cool Feature,
but isn't actually what I wanted:
I've made this little image to explain what's the problem:

Image: http://img.photobucket.com/albums/v416/kokkobil/TotalCommander.jpg

In the sampleset folder "Orchestra" I have some subdirectories (marked with Red dot). Inside each subdir there's another subdir with the same name (Green dot ones). Inside the Green dot ones there are my samples.
What I want is get rid of the Red dot subdirs, moving all the Green dot subdirs in the Orchestra folder (keeping the samples inside them, obviously).
The problem is that the one in the image is an example I've made: I have something like 1000 directories with that problem....
thanks anyway for the fast answer!
Kokko
User avatar
petermad
Power Member
Power Member
Posts: 16027
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2kokko
I have a solution for you:

First you download and install Ghislers packer plugin makebat.wcx from https://plugins.ghisler.com/plugins/makebat.zip

Then - if you got the space - you make a copy of the whole dir structure you want to alter - just as a precaution.

Then you do the following:

start TC with Full View in both panels. Open the first level of your dir in both panels - that means you should see all the dirs marked with a red dot in http://img.photobucket.com/albums/v416/kokkobil/TotalCommander.jpg

Mark all those dirs. Press Alt+F5.

Make sure that "Recursively pack subdirectories" is checked.

Click in the radiobutton just above "*needs external packer",

Choose "bat" in the dropdown list (see: http://www.madsen.homepage.dk/tcmd/packbat.png)

Write bat:3.bat in the file field.
Click OK and write: RD %D
Click OK

Mark all the dirs again (use Num+/)
Press Alt+F5
Write bat:2.bat in the file field
Click OK and write: DEL %N
Click OK

Mark all the dirs again (use Num+/)
Press Alt+F5
Write bat:1.bat in the file field
Click OK and write: COPY %N %D..
Notice the two periods after %D :!:
Click OK

Now execute the three bat files in the sequence 1.bat, 2. bat and last 3.bat

1.bat copies all the files in the deepest dirs one dir up.
2.bat deletes alle the files in the deepest dirs.
3.bat removes all the deepest dirs.

After you have run 1.bat you should check to see if the files really are copied one dir up, before you execute 2.bat and 3.bat
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
kokko
Junior Member
Junior Member
Posts: 4
Joined: 2005-07-08, 12:15 UTC

Post by *kokko »

Thank you, I'm going to download and try it!
Kokko
kokko
Junior Member
Junior Member
Posts: 4
Joined: 2005-07-08, 12:15 UTC

Post by *kokko »

I tried the Makebat, but it didn't worked.
Reading the install.txt file inside the zip I found that:

Important note:
===============

The plugin only works with FILES, not directories!So if you select subdirectories, the plugin will use
relative path names of the files in these subdirs.

:cry:

The cool thing is that I managed to copy the files in the "red dot" folders, so know the samples are in the upper level.
For the remaining empty subdirs I think the solution is Manual Deleting :cry:
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

kokko wrote:The cool thing is that I managed to copy the files in the "red dot" folders, so know the samples are in the upper level.
For the remaining empty subdirs I think the solution is Manual Deleting :cry:
YOu may us Delempty, a tool once written and provided by Hacker, I have uploaded again for the link I found was dead. It is a commandline tool which syntax can be found by running the program without parameter. It's prpose is to delete empty folders.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2kokko
For the remaining empty subdirs I think the solution is Manual Deleting
Another way is to use the content plugin DirSizeCalc. It can be used to search for empty directories from within Total Commander.
http://www.lefteous.de/tc/dirsizecalc_eng.htm
User avatar
petermad
Power Member
Power Member
Posts: 16027
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2kokko
It does work - I testet what I wrote to you thoroughly - That's all I can say.

Unfortunately now that you have managed to copy the files one dir up you cannot use my recipe any more to get rid of the files and the deep level dirs. It had to be done in excactly the sequence i wrote.

Of course if you have a backup of the whole thing, you could try again after restoring the backup.
kokko wrote: The plugin only works with FILES, not directories!So if you select subdirectories, the plugin will use
relative path names of the files in these subdirs.
And that's exactly what I did in my example.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply