Drag and drop folders, but filter files therein?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
aliteralmind
Posts: 261
Joined: 02 Dec 2014 16:49

Drag and drop folders, but filter files therein?

Post by aliteralmind »

My camera has these two folders:

-100_PANA
-101_PANA

each containing both jpg-s and mov-s. On my computer, I have

images/
- -100_PANA
- -101_PANA

video/
- -100_PANA
- -101_PANA

What I'd like to do is drag-copy the folders from the camera to each place, but when I drag to "images", it only copies jpg-s, and only mov-s to "video". Is it possible to filter the files in a drag-and-drop this way?

As it stands, I have to manually do this in each folder, and the number of folders is just going to increase over time. It automatically creates new ones as they fill up (which is something like several hunded).
Windows 8.1, 64-bit

aliteralmind
Posts: 261
Joined: 02 Dec 2014 16:49

Re: Drag and drop folders, but filter files therein?

Post by aliteralmind »

(How do I see folders when filtering? "Apply to files only (Find Files & Branch View - Visual Filters)" is checked, but I don't see them.)
Windows 8.1, 64-bit

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

Re: Drag and drop folders, but filter files therein?

Post by Enternal »

Visual filters? Make sure you prefix "\|" in it. So let say you want to filter all jpg and png files but also want to see folders. You will be using:

Code: Select all

\|*.jpg|*.png
It can actually be shorten to:

Code: Select all

\|jpg|png
I always add *. to all extension out of habbit.

Anyway, the code for the drag and drop would be something like:

Code: Select all

  $PatternPhotos = "*.jpg";
  $PatternVideos = "*.mov";
  $LocationPhotos = "E:\Desktop\TEST\Destination\Photos"; // Path to Photos
  $LocationVideos = "E:\Desktop\TEST\Destination\Videos"; // Path to Videos

  $Files = "";
  If <get drop |> != "" {$SelectedItems = <get drop |>;}
  Else {$SelectedItems = Get('SelectedItemsPathNames', '|', 'a');}
  ForEach($Item, $SelectedItems, "|") {
      If Exists($Item) == 2 {$Files = $Files."|".FolderReport("files", "r", $Item, "r", , "|")."|";}
      ElseIf Exists($Item) == 1 {$Files = "$Files|$Item|"; } }
  $Files = FormatList($Files, "tsed", "|");

  $SourcePhotos = FormatList($Files,f,"|",$PatternPhotos);
  $SourceVideos = FormatList($Files,f,"|",$PatternVideos);
  If $SourcePhotos != "" {Copyto "$LocationPhotos", "$SourcePhotos", "", -1;}
  If $SourceVideos != "" {Moveto "$LocationVideos", "$SourceVideos", "", -1;}
But basically, you manually put in the location of the photos and the videos folders in the $LocationPhotos and $LocationVideos. After that, you can just simply select a root folder you want to to the action on and it will then copy all photos into the location you set $LocationPhotos and move all video files into the location set by $LocationVideos. The script also allows you do select multiple folders so feel free to do so.

EDIT: I changed the code. It now supports drag and drop. Simply add a catalog item or custom toolbar button that load the script. Then you can drag all the folders onto the catalog item and it will automatically copy and move those files.

Post Reply