Separating folders containing particular file type

English support forum

Moderators: sheep, Hacker, Stefan2, white

Post Reply
GrimReaper85
Junior Member
Junior Member
Posts: 10
Joined: 2020-06-22, 20:15 UTC

Separating folders containing particular file type

Post by *GrimReaper85 »

I'll just start with my example, I have a lot of folders containing RAR and ZIP and some other file types.
What I would like to do is separate these folders to ones that contain RARs and ones that contain ZIPs.

But I have these constraints:
1. Folder structure must remain intact.
2. Folders must keep other files in them, not just RAR and ZIP.

I know how to do the first thing with TreeCopyPlus plugin, but then I am left with only RAR and ZIP and I'm still left with a lot of manual work.
Is there a way to do this in just a few steps?

User avatar
Dalai
Power Member
Power Member
Posts: 7118
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separating folders containing particular file type

Post by *Dalai »

Do a regular copy (F5) and specify the file types in the field "Only files of this type". e.g. in the form

Code: Select all

*.* | *.zip
(and the same for .rar). Note that this method will create empty directories when the source doesn't contain any file of the specified type.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups

GrimReaper85
Junior Member
Junior Member
Posts: 10
Joined: 2020-06-22, 20:15 UTC

Re: Separating folders containing particular file type

Post by *GrimReaper85 »

This copies every file other than ZIP. Directories which had ZIP and other files are not empty, they're just missing ZIP.
Empty I know how to handle, but this I don't.

User avatar
Dalai
Power Member
Power Member
Posts: 7118
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separating folders containing particular file type

Post by *Dalai »

Just to recap for understanding. The goal is to copy a directory structure with everything inside while separating ZIPs from RARs in the process. That's exactly what you can do with the file type filter above. Use it to copy the source to a destination of your choice, then repeat that to a different destination while excluding *.rar instead of *.zip this time. Result: Two directory identical directory structures containing all files, except *.zip or *.rar respectively.

If I didn't understand that correctly, it would be nice if you could provide an example of what your directory structure looks like now and what it should look like.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups

GrimReaper85
Junior Member
Junior Member
Posts: 10
Joined: 2020-06-22, 20:15 UTC

Re: Separating folders containing particular file type

Post by *GrimReaper85 »

Let me give a simple example.

Before:
Main folder
1st subfolder: RAR1, TXT1
2nd subfolder: ZIP1, TXT2
3rd subfolder: RAR2, TXT3
4th subfolder: ZIP2, TXT4

What I want:
Main folder 1
1st subfolder: RAR1, TXT1
2nd subfolder: RAR2, TXT3
Main folder 2
1st subfolder: ZIP1, TXT2
2nd subfolder: ZIP2, TXT4

Your solution would also give me:
Main folder 1
3rd subfolder: TXT3
4th subfolder: TXT4
Main folder 2
3rd subfolder: TXT2
4th subfolder: TXT4

And this is no good. It's easier for me to just copy all ZIP to one folder and then manually select them in another panel. But I won't be doing this before finding a better solution as I have 17 main folders with 100-2000 subfolders and 50-300 subfolders with ZIPs which I have to move elsewhere.

For TXT I have 3 text file types, but it would be better if it just worked for every file except RAR and ZIP.
ZIP are all .zip and for RAR it would be better if it searches for .r00 and .002.
Last edited by GrimReaper85 on 2020-06-23, 08:17 UTC, edited 2 times in total.

User avatar
Dalai
Power Member
Power Member
Posts: 7118
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separating folders containing particular file type

Post by *Dalai »

Well, you should at least try my suggestion. No harm done if it doesn't fit your needs, and maybe another idea comes up. Excluding more than one file type is simple by just adding it after the pipe symbol like the *.zip above:

Code: Select all

*.* | *.rar *.r01 *.r02
or more generically

Code: Select all

*.* | *.rar *.r??
Note that the second filter also applies to other file types like *.rtf.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups

GrimReaper85
Junior Member
Junior Member
Posts: 10
Joined: 2020-06-22, 20:15 UTC

Re: Separating folders containing particular file type

Post by *GrimReaper85 »

I solved this today.
What I did is:
1. Here I found a command to copy all ZIPs (with folders) to a temporary folder:
https://ghisler.ch/board/viewtopic.php?f=26&t=46765
You can also use this plugin, but it's more time consuming, I only use it when I also have to search for particular size:
https://totalcmd.net/plugring/TreeCopyPlus.html
But with this plugin I somehow got into some limit, search found 1170 ZIP files and when I copied them, it copied only 600-900 (different number every time).
And as far as I can remember dupe check also has some limit. Anyway, to solve this issue, just go by subfolders with smaller file count, and if you don't have any, create them.

2. And today I just googled this:
"total commander select folders in right panel with same names as in left panel"
And first Youtube video was the answer to my problem.
Now you just select in left panel the temporary folder with just ZIPs, CTRL+A, press this new button and you have them selected in right panel and you can do with them as you please.

It would be better if this can be done in one step, but this was sufficient enough for me as I was done with everything in 2 hours (there were some exceptions I had to take care of).
Last edited by GrimReaper85 on 2020-06-30, 15:52 UTC, edited 1 time in total.

User avatar
petermad
Power Member
Power Member
Posts: 9662
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Separating folders containing particular file type

Post by *petermad »

It would be better if this can be done in one step
Here is the solution I use in my Extendend Menus - one step button:

Code: Select all

TOTALCMD#BAR#DATA
cm_SelectAllBoth,cm_CopyNamesToClip,cm_FocusTrg,cm_GoToFirstEntry,cm_ClearAll,cm_LoadSelectionFromClip,cm_CopyNamesToClip,cm_FocusTrg,cm_ClearAll,cm_LoadSelectionFromClip

wcmicons.dll,72
Mark files and folders that exist in both windows


-1
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524
Danish Total Commander Translator
TC 9.51 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1909) 64bit, 'Everything' 1.4.1.965 (x64)
TC 3.0 on Android 6.0
Get:
Extended Total Commander Menus | TC Languagebar | TC Dark Help | PHSM-Calendar

User avatar
vdijken
Member
Member
Posts: 116
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Re: Separating folders containing particular file type

Post by *vdijken »

1) Copy the file structure
2) Delete in one all .rar files; in the other all .zip files.
3) Eventualy use a tool to delete empty directories.

User avatar
nsp
Power Member
Power Member
Posts: 1287
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Separating folders containing particular file type

Post by *nsp »

To separate folder containing some files type, i use emptywdx 0.0.3 plugin and specific filter type in the ini file used as custom column..
This is an answer on how to separate, not copy, rename ....
You can also use fileinDir64 wich seems to be newer..

http://tccfestuff.free.fr/EmptyWDX-0.0.3c.7z

User avatar
nsp
Power Member
Power Member
Posts: 1287
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Separating folders containing particular file type

Post by *nsp »

You are not clear about the numbering and your real need, could you be more explicit about RAR1, TXT1, ZIP2 TXT2 1st subfolder .... real and full names (input structure / expected structure)...
It could be possible to list all rar and zip only using branchview and filter and tbuild a dedicated script to create folder in Zip or Rar structure and copy all the file next to the pivot zip or rar file...

GrimReaper85
Junior Member
Junior Member
Posts: 10
Joined: 2020-06-22, 20:15 UTC

Re: Separating folders containing particular file type

Post by *GrimReaper85 »

Numbering is not important, I just wrote that to note that they are different files.

Solution is actually the same as in my other topic, FileInDir plugin:
viewtopic.php?p=389850#p389850
That's just easier way, I was actually already done with this work yesterday as I described above.
But thanks to petermad, that button is better than the one in my post.

When I made that topic I didn't know it would be similar to this. And I actually still have to find a dupecheck in that topic.

Post Reply