Automatically unsync a folder based on time or size

First of all, odrive is a awesome app. Congratulations!

I need your help on a single thing. I want to Unsync a folder from time to time automatically. I explain why.
I use Hazel to make a complete Version and Lifecycle management. I use Amazom Cloud Drive for RIP - the last stage in a file lifecycle. Since AMC has no size limit, I want to let files there indefinitely. However, I need to let RIP folder sync. So, it’s important from time to time to Unsync all files or a group of files based on a time criteria.
Unfortunately, auto unsync is global and not by folder basis. Is there a way to make this happen using Applescript or anyother way?
Thanks in advance for your help!!


As you’ve seen, auto unsync is currently limited to a time period and a global setting. As part of a blog post I did on the odrive CLI, I wrote an example script that can selectively unsync based on file properties/characteristics like extension, size, and date. You could use that script, or a modification of it, to target your unsyncs in an automated fashion by running it as scheduled task.

Thanks for your help. Could you, please, make a step by step how to run it as a shell script? I’m new to this.

I really appreciate your help.


It sounds like you are running this on a mac. In that case you can do this:

  • Go to and download the script to your Downloads folder.
  • Open a terminal session (type “terminal” in Spotlight search):
  • Copy and paste the following command into the terminal and hit enter:
    cd "$HOME/Downloads";chmod 755;
  • You can now run the unsync script. This command will give you the script help:
    ./ -h
  • An example command to unsync all files older than 50 days in “odrive/Amazon Drive/My Folder” (just as an example), would be:
    ./ -d 50 "$HOME/odrive/Amazon Drive/My Folder" -r

You can then use that same script to run during scheduled times on the Mac to unsync specific paths according to size or date. This is a pretty good consolidated source for how to run scheduled tasks on Mac:

Hi Tony,

It’s working flawlessly. Now, I need your extra effort to make my implementation even better.
Unsync-by-sh hadles a set of files. Sometimes, I need to handle a single file. So, I need to use odriveCLI ( basic comands: sync, unsync, etc.

I’ve got 3 questions:

  1. odriveCLI ( has a path including odrive version. How can I make this work without depending on path with version? My concern is the needing of update my implementation every time odrive is updated.

  2. Do I need to use Python CLI client? Is there any other client for Mac?
    I’ve read this
    I’ve tried to run this other client commands but this paths are invalid.

  3. Can you give examples of sync, unsync and other basic commands in shell scripts using odrive CLI client directly?

I really appreciate your help. As a customer using odrive Premium, I can tell you: this support is so important for customer.



You can see how I do this in the script here:
I also use this method in the help examples below in 3)

Hmm, yeah the blog post may be out of date. i will need to update that. You can get the direct download links for the CLI here:

Take a look at the help that is built into the cli client. You can get usage help and clarification on passed parameters by issuing commands like this:

General help:
python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1) -h

Specific help for sync:
python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1) sync -h

Specific help for unsync:
python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1) unsync -h

Hi Tony,

Thanks for your patience.

Some extra questions:

  1. What’s the best CLI client to use? Python or OS X Binary? I ask this because all your example are Python based.
    Is it better?

  2. Can I have both CLI clients installed on my Mac? How to do it? I understood Python CLI client is already installed, right? How to install OS X Binary?

  3. How to make (Python client) and odrive (OS X Binary) available? I mean, in order to run it today, I need to specify a path. What do I need to do to just submit a command like “python - h” - without path declared?

  4. I am doing this to use odrive CLI client commands through Hazel events. I can execute shell scripts directly from Hazel. Can you give a example of a shell script with unsync or sync CLI commands?
    Hazel has a feature to run embedded scripts. So, my idea is to insert this shell scripts directly there.

Thanks once again for all your commitment and support.


The are functionally the same. For Mac users I generally reference the python version because it doesn’t require an additional download. The Python version also allows for modification, if you are so inclined.

You can have both, although there probably isn’t a need. They both do the same thing, so it is just a matter of which one you run. Take a look at the documentation here for installation on the binary version:[quote=“, post:7, topic:2497”]

  1. How to make (Python client) and odrive (OS X Binary) available? I mean, in order to run it today, I need to specify a path. What do I need to do to just submit a command like “python - h” - without path declared?

There are a few different ways to do this. The easiest is probably to just include it in your .bash_profile file like this:

  1. Open terminal
  2. Type: nano ~/.bash_profile
  3. In nano add the line: alias odrivecli="python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1)"
  4. Press Ctrl+x then press y then hit enter to save the changes and exit the editor
  5. Restart terminal and now using the command odrivecli will run the CLI[quote=“, post:7, topic:2497”]
  1. I am doing this to use odrive CLI client commands through Hazel events.

I’ve never used Hazel before, but a sync command, after setting the alias above, would be:
odrivecli sync [path to placeholder file (.cloud/.cloudf) here]

For example:
odrivecli sync "$HOME/odrive/Amazon Cloud Drive/"

An unsync command would be:
odrivecli unsync [path to odrive-contained file or folder (not a placeholder file) here]

For example:
odrivecli unsync "$HOME/odrive/Amazon Cloud Drive/myfile.txt"

Hi Tony,

Thanks for your help. It’s everything working perfectly.

It’ll be impossible without your help and patience.



Glad I could help!