I have 3 folders I want to compress to an archive and put that archive in a specific location. I'm running in to a few different issues depending on how I tackle the problem. All 3 files live in ~/Library/Logs/, one of the folders is the child of another folder within logs. Here's what the current structure looks like:


I want to compress "Phone", "Cort", and "Logs" (Media/Cort/Logs folder) from the ~/Library/Logs/ folder. Ideally I'd like to just have the zip archive laid out like this:


The first issue is that I do not want to use the direct path (macintosh hd/users/MyAccount/Library/Logs/), I'd like to use ~/Library/Log/ since this will be used for multiple different users.

The second issue is that I do not want to have to choose or select the items via finder since the path will never change for these folders.

The ditto command seems to somewhat do what I want, it doesn't change the folder structure, but I can only do 1 folder at a time.

I've tried to use some similar automator setups such as this one Create a zip file using an Automator Service but I can't seem to make it work without the folder selection prompt, no matter how I pass my paths to it. Every other bash script or automator service seems to be zipping each folder individually, which I also do not want.

  • What is the "specific location" you want the .zip archive to be in? How is the User going to invoke the process? Do you want it as an Automator application? Is shell scripting okay? If MyLogs.zip already exists, how do you want to handle it? – user3439894 Apr 16 at 20:17
  • Sorry about leaving out the super vital information! The path can be ~/Documents (it's going to change eventually but I can figure out how to do that). The user can invoke it by Applescript's "do shell script" or just a fancy applescript, or an automator application. Originally I was going to use an applescript "do shell script" command and append $(date +%Y-%m-%d-%H-%M) to the file name to prevent conflicts. – Feanux Apr 17 at 11:53
  • All I can say it the example code shown in my (now deleted) answer, as is or fixing the error in your example, works for me without issue under macOS Mojave, the version of macOS you're using. Since I cannot see your actual Automator workflow, or examine how your system is configured, I've decided to delete my answer and bow out. All I can say is there is something not right about your system or how it's configured and the example code I presented is pretty basic and under normal defaults should work without issue. Good luck! – user3439894 Apr 17 at 21:28
  • Thank you for all the help, I super appreicate the effort. I'll try to track down the issue and figure out what's going on. I've tested on two iMacs running the same MacOS version (latest) and still have the same issue. I've gone as far as creating a new account as well. He is my workflow, error, and pathing, if it helps at all - imgur.com/a/XPGGUT8 – Feanux Apr 17 at 21:31
  • The only thing I noticed in the screen shot of the Automator workflow is its name says "Untitled (Application) -- Edited" which means the current code has not been saved. You need to save it again before running it. – user3439894 Apr 17 at 21:44

You must log in to answer this question.

Browse other questions tagged .