Copy Files From Specific Folders

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
GeorgeAl
Junior Member
Junior Member
Posts: 3
Joined: 2020-09-20, 13:12 UTC

Copy Files From Specific Folders

Post by *GeorgeAl »

Hello, I would like to copy only the files that folders with a specific name contains. Moreover, I want to keep the folder structure.
I manage to do it, partially, through the search bar, but I can not keep the folder structure this way.
Any suggestions?
Many thanks for considering my request.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Copy Files From Specific Folders

Post by *Dalai »

You might be able to keep the directory structure by using one of the pseudo packer plugins TreeCopyPlus or CopyTree. Instead of simply copying the files, you need to "pack" them. The plugin readme's should contain information on how to use them.

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

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy Files From Specific Folders

Post by *petermad »

2GeorgeAl
I manage to do it, partially, through the search bar
Try to save that search and the in the copy dialog (F5) use the saved search in the "Only files of this type" field.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: Copy Files From Specific Folders

Post by *NotNull »

So you want to copy all folders that contain a specific file, let's say backup.me? (your description wasn't very clear)
Yo wnat these folders copied to (let's say) X:\Backup and want to preserve the folder structure?

I would use Everything for that (assuming you have it installed):
  • In Everything, search for:

    Code: Select all

    "c:\start folder"  child:backup.me
  • Select all folders
  • Menu:Edit > Advanced > Advanced Copy to Folder
  • Old format: C:\start folder\%1
    New format: X:\Backup\%1
  • Check the preview if all is OK
  • Press OK button.
  • Done
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy Files From Specific Folders

Post by *petermad »

NotNull wrote:So you want to copy all folders that contain a specific file
I think GeorgeAl wants files from folders with specific names.
GeorgeAl wrote:I would like to copy only the files that folders with a specific name contains
But I agree it is not very clear what GeorgeAl means (it seems that there are words missing in the first sentence - disturbing the meaning).

Maybe GeorgeAl could give an example with specific names of files and folders that he wants to be copied.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
NotNull
Senior Member
Senior Member
Posts: 266
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: Copy Files From Specific Folders

Post by *NotNull »

petermad wrote: 2020-09-20, 20:56 UTC I think GeorgeAl wants files from folders with specific names.
This is one of those "Do you see a young woman or an old witch in this picture" kind of descriptions :)
With a lot of effort, I now see the other 'picture' too.

If it is as you described, search in Everything for folder: "c:\start folder" "specific name" instead.
Rest of the steps are the same.

But you are right, there might even be a third 'picture'. Only GeorgeAl can tell ...
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy Files From Specific Folders

Post by *petermad »

Here are three scenarios:

1. If I want to copy all files from any subdir named "mydir" including full folder structure down to the mydir folder(s), I can use this in the copy dialogs "Only files of this type" field:

Code: Select all

mydir\* |**\
the |**\ is to exclude dirs that does not contain a mydir in the path


2. If I want to copy all .txt files including full folder structure, I can use this in the copy dialogs "Only files of this type" field:

Code: Select all

*.txt |**\
the |**\ is to exclude dirs that does not contain .txt files.


3. If I want to copy all .txt files from any subdir named "mydir" including full folder structure down to the mydir folder(s), I can use this in the copy dialogs "Only files of this type" field:

Code: Select all

mydir\*.txt |**\
Note files from folders below "mydir" will NOT be copied.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy Files From Specific Folders

Post by *petermad »

A fourth scenario:

If I want to copy files from several specific subdirs, I just list all of them:

Code: Select all

mydir\* myotherdir\* yetanotherdir\* |**\
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
GeorgeAl
Junior Member
Junior Member
Posts: 3
Joined: 2020-09-20, 13:12 UTC

Re: Copy Files From Specific Folders

Post by *GeorgeAl »

Thank you all for the answers.
I meant that only want to copy the files that folders with a specific name have.
e.g., I have three tv-series with a structure of season (...), season 2 (...), etc., and a folder with extras; I want only to copy the folder extras, but I also want to keep the folder structure of the tv series.
I hope to make myself clear. It is hard trying to describe something so unusual.
I manage to do it with copy whiz, but I would like to do it with total commander because it is better.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Copy Files From Specific Folders

Post by *petermad »

2GeorgeAl
Then try this: Mark the main folders for the 3 TV series, press F5 to copy, and put

Code: Select all

extras\* |**\
in the field: "Only files of this type"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
GeorgeAl
Junior Member
Junior Member
Posts: 3
Joined: 2020-09-20, 13:12 UTC

Re: Copy Files From Specific Folders

Post by *GeorgeAl »

petermad wrote: 2020-09-22, 02:12 UTC 2GeorgeAl
Then try this: Mark the main folders for the 3 TV series, press F5 to copy, and put

Code: Select all

extras\* |**\
in the field: "Only files of this type"
Thank you. That works great.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: Copy Files From Specific Folders

Post by *gdpr deleted 6 »

Just an addendum:

If the folder(s) in question (here "extras") have non-empty sub folders that should be copied as well, specify this in the "Only files of this type" field:

Code: Select all

extras\**\* |**\
(extras\* will only copies files directly located within the "extras" folder(s), but not any files in any sub folders of "extras")



The ** part of a file mask pattern is unfortunately somewhat poorly documented, and you will have to search the history.txt file to find some explanation for it:
history.txt wrote:29.01.17 Added: New wildcards for relative dirs now support wildcard **, which stands for any number of subdirs, e.g. subdir\**\*.txt finds text files where the relative path contains "subdir" anywhere in the path (32/64)
shownomarcy
New Member
New Member
Posts: 1
Joined: 2022-11-05, 20:13 UTC

Re: Copy Files From Specific Folders

Post by *shownomarcy »

petermad wrote: 2020-09-20, 21:21 UTC Here are three scenarios:

1. If I want to copy all files from any subdir named "mydir" including full folder structure down to the mydir folder(s), I can use this in the copy dialogs "Only files of this type" field:

Code: Select all

mydir\* |**\
the |**\ is to exclude dirs that does not contain a mydir in the path
What if I want to copy only the subdirs and their files BUT without folder structure? (I dont want the parent folders, only the mydir folders (and their contents)?
I managed to do it thru Alt+F7 search, but I wonder what is the code in this case?

Thanks!
Post Reply