CLI external folder MacOS

mac

#1

It would be super helpful to be able to only sync new files that land in an external folder. I figured I might be able to do this with the CLI. After following the instructions to setup and use the CLI I am able to sync folders in my “odrive-agent-mount” but when I try to point the command to my external folder and sync a file I get a message saying “Unable to sync test.cloud. This file doesn’t exist.”

I saw this post with a similar question but on Linux. I attempted to make another mount, but I’m not sure I understand “make another mount using the mount”. Are there instructions anywhere to use the CLI with an external folder on an external drive?


#2

Hi @brenton,
You can use the “sync to odrive” feature with the desktop client to sync a specific external folder. This sounds like what you want to do. Take a look here for more information:


#3

Thanks for the response. We do sync external folders a lot. It’s a great feature, one of the major selling points for us.

What I meant was we don’t want to sync every file in those folders. We only need the most recent files. So when a new placeholder lands in a folder we’d like to download it, without having the folder set to download everything.

I was hoping to use the CLI to write a script that ran whenever a new .cloud file showed up in a folder.


#4

Hi @brenton,
I see. You can actually still use the “sync to odrive” feature, but do not setup folder sync rules on it (so it doesn’t automatically download) new files that show up. You can then use the CLI to interact with the desktop client and tell it to sync individual files (you don’t need the agent for this, since the desktop client acts as the agent).

Does that make sense?

The reason I am pushing to use the desktop client is that you can run into some issue when trying to run two different sync engines at the same time (odrive desktop and odrive agent). The desktop client responds to CLI commands the same way the agent does.


#5

@Tony thanks you, yes. that sounds exactly like what I want to do. When I look online everything is pointing me to examples using the odrive agent mount. Are there examples, or could you give me one, of how I would format the command with the CLI talking to the desktop client instead?


#6

Hi @brenton,
The CLI syntax is the same for both the agent and the desktop client. Can you provide an example of a task you would like to execute with the CLI and then I can give you the syntax?


#7

So I’d like to have any new .cloud file that lands in a an external folder get sunk. Identifying the path of the new .cloud file isn’t a problem. I just want a script I can run to say sync the .cloud that is this file path, where the file path points outside the odrive folder.


#8

Hi @brenton,
On a Mac you can run a command like this:
python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1)odrive.py sync "[absolute path to cloud file here]"

The above uses the odrive.py CLI in the standard desktop install. Since we version those folders, the funky ls + tail command will ensure that the command works after upgrades. You can also substitute the binary CLI in its place, or alias that command to make it easier to run on-demand.


#9

that works perfectly. thanks so much @Tony


#10

Great! Thanks for confirming @brenton