Rich copy multiple folders+structure + specific file ext's?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Stilez
Posts: 107
Joined: 23 Aug 2010 14:32

Rich copy multiple folders+structure + specific file ext's?

Post by Stilez »

Title says it all.

I have about a zillion backup folders in the root of my backup drive, and a lot of those will have folders containing jpeg/jpg images nested somewhere in them. What I'd like to do is multi-select the relevant folders which *could* contain photos I'm interested in, and copy these and their structure and any jpg/jpeg files in them (but not other extensions) to a new location.

My aim is to create a duplicate of these folders and their structures, but not copy the actual files they contain other than jpg/jpeg (I'm not interested in any other extensions and the folders include a *lot* of other files, including a lot of large files, which will be very slow if I copy everything).

I'm sure this can be done but it's beyond my skill level?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Rich copy multiple folders+structure + specific file ext

Post by highend »

Executed from the root path of your pictures...

Code: Select all

copyto "<your backup destination folder>", quicksearch("*.jpg;*.jpeg", , "|"), <curpath>;
One of my scripts helped you out? Please donate via Paypal

Stilez
Posts: 107
Joined: 23 Aug 2010 14:32

Re: Rich copy multiple folders+structure + specific file ext

Post by Stilez »

Thanks. One question, what if the source is several (but not all) subfolders in a location. For example with a tree:

By that I mean, rich copy the structure and *.jp* in the files and folders that are selected in the right hand contents pane. So I can select some folders and files, then rich copy only the *.jp* and structures from those folders, not all folders in a single root.

Example, if D:\ contains:

D:\A\
D:\B\
D:\C\D\
D:\C\E\
D:\F
D:\pic.jpg

I want to select some folders/files in the right hand pane (such as D:\A\, D:\B\, D:\C\E\), then rich copy those structures and *.jp* nested in them (only).

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Rich copy multiple folders+structure + specific file ext

Post by highend »

Something like:

Code: Select all

    foreach($folder, <get SelectedItemsPathNames |>) {
        $files = quicksearch("*.jpg;*.jpeg", $folder, "|");
        if ($files) { copyto "<your backup destination folder>", $files, <curpath>; }
    }
?
One of my scripts helped you out? Please donate via Paypal

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Rich copy multiple folders+structure + specific file ext

Post by Enternal »

Wow highend! So compact! When I did something like this before, mine was several lines instead of just a single line!

I will take my leave now since I have nothing to add lol.

Post Reply