Move files up to a relative directory


#1

Hi. I'm new to Keyboard Maestro. I recently put together a macro to move files up in the directory hierarchy to a designated folder named "Historical." That folder is always in the same relative place as it's part of a templated out folder system.

Anyway, I've been able to get my macro to work, but I wanted to post it here and see if anyone had any suggestions about how to maybe do it better.

Move File to Historical.kmmacros (5.4 KB)

Thanks

Eric

25%20PM


#2

Hey Eric,

At first blush your macro looks pretty simple and solid.

Here's how I would do it.

There's nothing wrong with how you're doing the task – I'm just providing this in contrast.

Move File to Historical -- AppleScript Version v1.00.kmmacros (6.4 KB)

The meat of the script is only 6 lines.

-Chris


#3

Your macro looks fine. You might like to use the Assert action instead of the If Then Else Error technique. So basically:

  • Set variable DestFolder
  • Assert at this path a folder exists
  • Move

#4

Thanks! I'll check this out. I don't really know Apple Script, but I'd love to learn.


#5

Cool! Appreciate the suggestion. I'll check out the Assert action. I don't know much about it. Glad to expand my KM knowledge. Cheers.