Automating Path Finder

Hey Folks,

I think I'll try to link to the various Path Finder threads in this one, but I'll make up my mind when I have the time to fool with it.

In the meantime this macro shows:

  • How to get the Path Finder selection as a list of POSIX Paths via AppleScript.

  • How to get that list into a Keyboard Maestro variable from AppleScript.

  • How to get a Keyboard Maestro variable into AppleScript.

  • How to use the selected items path list to copy the items to a destination directory.

-Chris


Path Finder -- Copy Selected Items to a Given Directory.kmmacros (7.2 KB)

7 Likes

Have you tried this if there is a conflict which is very common - Same file name is already exist in the Given Directory meanwhile only an error info pop-up,

I thought it should be a pop-up window to ask what you need to do like default action after you move or copy a file via Finder or Path Finder. :grinning:

Here is the screenshot of the default window of Path Finder [sorry , it's in Chinese UI, But nothing special, such as asking for Stop, Overwrite or Keep Both files, blahblah.)

(BTW Finder does the same thing)

Links to Other Threads about Path Finder

I think for the most part you can find all Path Finder scripts/macros uploaded to the Macro Library with this simple search:
https://forum.keyboardmaestro.com/search?q=%23macro%20in%3Afirst%20tags%3Apathfinder

If you want a more inclusive search, you can just use the pathfinder tag:

Hey @shruru,

Obviously I didn't do anything to actively handle collisions in my macro above.

The mechanism I'm using is passive.

Keyboard Maestro's Copy a File action will NOT overwrite a file/folder at the destination by design, so any existing files/folders at the destination are safe.

My macro will show a notification if there is a failure, but that's it.

There are ways and means to do as you suggest, but I'm not interested in pursuing them. You on the other hand are quite welcome to take the idea and run with it.  :sunglasses:

-Chris

1 Like

@ccstone and @shruru:

Interesting note/inconsistency here.

While the Copy a File Action will NOT overwrite an existing file, and will cause the Macro to abort/cancel IF the "Failure Aborts Macro" option is checked, the Write to a File action DOES allow an overwrite of an existing file. The "Failure Aborts Macro" option has no effect on this.

Write To File Action Overwrites Existing File

image