How to zip, date-stamp, encrypt & send a folder?

Discussion in 'Mac Basics and Help' started by jennyp, Dec 3, 2014.

  1. jennyp macrumors 6502

    Oct 27, 2007
    I'm wondering if there's some software or other to do the following:

    At a pre-determined time of the day, zip a fairly large folder (say ~1GB), append a date-stamp to the zipped filename, encrypt the zipped file, and send it to either a local or remote place.
  2. chown33 macrumors 604

    Aug 9, 2009
    A shell script could do that. So could an Automator workflow, which can be scheduled as a daily repeating event using

    For a shell script you need to specify :

    • Be specific about exactly how you want it encrypted. The algorithm to use, where the keys are stored, etc.
    • Specify exactly how you want to email it, and how to choose between the local or remote place. is scriptable, but it might present difficulties if no one is logged in at the time. I'm speculating about that as a potential problem. The alternative is to use command-line email, which means it would need to be configured to work first, as it doesn't use's preferences, settings, etc.
    • Exactly what should happen if the computer is asleep when the correct time comes around. Should it automatically wake up? Should the zip, encrypt, send occur later, when the computer next wakes up? You should describe what you want to happen even if you expect it to never happen, i.e. the computer should always be awake.
  3. jennyp thread starter macrumors 6502

    Oct 27, 2007
    Thanks for replying. I'm glad to know it's possible in principle, but I have no experience with shell scripts. Do you know of any tutorial resources that would get me started? I might be better with Automator !
  4. chown33 macrumors 604

    Aug 9, 2009
    I suggest playing around a bit with Automator and Calendar, and deciding how you want to email the result. You won't need to be an expert, but it will help if you're familiar with the basics. For example, if you can figure out how to use Calendar to run an Automator workflow, even a sample one, at a specific time of day, then you've solved that part of the overall problem.

    If there are no more replies in the next day or so, I'll ask the moderators to move this thread to the Mac Programming forum, and we'll take it from there. The shell script to do the zip-and-encrypt will be pretty easy to do, maybe a few lines at most, and people who frequent Mac Programming will be able to give specifics. I'm a frequent visitor there myself.

    I want to wait and see if someone suggests something else, especially if it turns out to be easier for you to work with.
  5. jennyp thread starter macrumors 6502

    Oct 27, 2007
    I'm experimenting with Automator, and I've managed to make a workflow which gets the Finder item and then creates an archive with a date-stamped name. I'll now try the calendar part. As far as I can make out the wake/sleep issues can only be circumvented by making the workflow run when the Mac is scheduled to be awake, though I'm not 100% sure of this. I should have added that my aim was also to prune the destination folder of N copies of the file.

    Yes I should have put this in the Mac Programming forum I guess ! Sorry!
  6. chown33 macrumors 604

    Aug 9, 2009
    Congrats on getting that far with Automator.

    Sleep/wake might be addressed using a scheduled wakeup, a feature that's available here:
    System Preferences > Energy Saver pane > Schedule button (lower right?)

    Don't worry about not posting in Mac Programming. I've asked the moderators to move the thread.
  7. jennyp thread starter macrumors 6502

    Oct 27, 2007
    I ditched the Automator workflows as I successfully wrote a little shell script that does the zipping and appends a date-stamp.

    I evoke the shell script with Carbon Copy Cloner, which runs it just before it does its disk clone in the night - which means I don't have to worry about the timing or waking the Mac.

    The "sending" is just placing into my Dropbox folder.

    It's virtually what I wanted - except, it doesn't include the encryption, and I don't yet know if that's even possible with a shell script (every file could have the same super-long password for all I care).
  8. chown33 macrumors 604

    Aug 9, 2009
    You can use the 'openssl' command to perform encryption. See its man page here:

    Since 'openssl' has a bunch of sub-commands, the top-level man page is just a summary of the sub-commands. You'll have to look at other man pages for details (see the end of the 'openssl' man page).

    The encrypt sub-command is 'enc', and its man page is here:

    A good cipher would be Blowfish CBC, whose name is 'bf-cbc'. Another good one is AES-256-CBC. If you want other suggestions on how to use a specific cipher, ask again.

    The full set of command man pages is here:

    The 'openssl' sub-command man pages are under Section 1ssl you see on that page.
  9. jennyp thread starter macrumors 6502

    Oct 27, 2007
    Hey chown33 - thanks for that really helpful info :)

Share This Page