I've having a hard time trying to figure out how to compress (zip) a specific folder at a specific time and day (day of week or day interval)
After it's compressed I want it to upload the zip file to my FTP server. After it finishes uploading, I want it to trash the zip. But I can't even get it to compress the folder. The only action I found for selecting the folder is the Prompt for Folder action, except it wants me to respond but I want this all to be done without me being at my computer.
If there's a post that addresses this, I'd appreciate a link to it. I've tried searching but haven't found quite what I need.
I'm hoping there's a way to do this! Thank you in advance.
The most direct way to do this is to use an Execute a Shell Script action.
- FTP with Curl
Here's a start:
Zip Folder (& Sub-Folders) & Move to Trash
Thank you for your reply. Unfortunately scripting is far outside my abilities. What I was hoping to do is create a sequence of actions that would use menus and pauses — as if I were doing it manually. I know it may sound clunky, but it’s sufficient.
The name and location of the folder I want to compress will never change. I know how to use KM to open a folder window, but I can’t find a way to have it select a file or folder within that window (so that I can perform a sequence of menu commands on it). I assume I can include a step to type the name of the file to select it, and that’s what I’ll try if there’s no alternative, but I thought it might be less problematic to specify the folder name in a step — if there is such an action. Does such an action exist in KM?
This task is very difficult to do without scripting – unless you know how to cheat.
The big problem is the compress menu in the Finder gives no usable clues when the compress job is finished. (Only tested in Mojave today.)
Keyboard Maestro can't see the compress pop-up window in the Finder, and that window doesn't always appear.
So. What to do...
You need to know about macOS' Archive Utility, and you need to set it up properly.
The Archive Utility gives you a bonafide UI to work with, and Keyboard Maestro can see its windows.
Here's a starting point for your task.
Zip a Specific Folder in the Finder v1.00.kmmacros (7.4 KB)
Is the Archive Utility a separate app I need to download? I don't see it in the Utilities folder. I am still using Catalina.
I don't mind programing in a pause to give the Compress menu time to complete and then wait for me to hit a "continue" button or something like that. The folder I'm compressing doesn't change in size very much so I could time it and allow some additional time. This shortcut is meant to remove some of the drudgery of this task so I don't procrastinate doing it. I don't mind cheating to get there. But I'll still look at your instructions once I locate the Archive utility. But if it's part of Terminal, I'll have to stay away from it!
Thank you so much for your time -- it's much appreciated!
No. The macro should just run if you give it the appropriate path.
Search for “Archive Utility” with Spotlight.