Feature request: allow scripting odrive folder

I would like a little command-line tool that works with the sync extension and would let me do from bash the things that I can currently do from Finder. In particular, sync and unsync and see the sync status of a file.

Thanks for reaching out Andrew.

Would you mind giving me some details on your use case and workflow for this feature. This is something that we have recently been looking at, so I am very interested in hearing what people have in mind for it, specifically.

Thanks!

I think there was a request for this on the older forums. Anyway, I’d like to chip in with my use cases (I’m a Windows user).

Firstly, I do a lot of stuff in CMD prompts, and it’s a pain to go back to explorer, locate the folder I’m in, sync the folder I was trying to navigate into, etc.

Secondly, I have an Autohotkey script that gives me shortcut keys in Explorer for a lot of things I do often, e.g. running AstroGrep, opening files in Sublime Text, doing a compare with BeyondCompare etc… I’d love to be able to add a shortcut key for sync/unsync.

I can also envisage a command-line tool to be useful when trying to automate backups or any other types of operation, e.g. some pseudocode
odrive sync
while( odrive checksync )
wait for 5 seconds
copy files to somewhere else
odrive unsync

2 Likes

An immediate use-case for having CLI options would be as a work-around for the Windows Explorer context-menu-missing issue that several of us are experiencing!

That said, i can imagine many possible uses for a scriptable executable, especially in my work world where I’m mostly on OS X.

And, when a Linux client eventually (soonly?!? : ) emerges-- there must be a CLI option, as I’m constantly working on several of my home Linux machines via ssh…

Mike

1 Like

My use case is that I like to use my Amazon drive to store backups of video files as I’m working on them. They are often many megabytes to a few gigabytes and take a while to finish the sync. I don’t want these backups taking up space on my laptop, so I tend to unsync them right after I notice that they’ve finished. The thing is, and you may have caught it yourself, it might take a few minutes before the sync finishes and it’s safe for me to do this.

Much of the rest of my workflow is just done at the command line, so writing a little script that says:

$date = $(date '+%Y%m%d-%H%M%S')
$file = "$odrive/Amazon Cloud Drive/Archive/$date/$1"
cp $1 $file
while odutil --syncing $file 
  do sleep 1
done 
odutil --unsync $file

Hm, it looks like @Tenebrous just said essentially the same thing.

I would love this too.

Scripts I would write:

  • Unsync old files only
  • Unsync folders or files when syncing is complete (like the other posters, above)
  • Sync or unsync a collection of related folders in different places (for example, I want to work on Blender files today, so I need to sync ~/odrive/apps/blender.app and ~/odrive/files/blender_scenes and ~/odrive/images/textures)
  • On-demand sync of files needed by some other task I’m scripting
  • Automate backups between cloud providers
  • Generally automate things I would have to do by hand

any other use cases for this? want to get all the feedback we can. anyone interested in doing this sort of thing on a raspberry pi?

1 Like

would love to be able to use odrive cli (via optware maybe?) on a pogoplug… : )

Hm, now that you’ve mentioned that…

It would be neat to setup a raspberry pi to emulate a USB storage device. :wink: I think they can do that… Then I could run odrive on there with an emulation layer where it would just sync the files that are actively being accessed and unsync the others. It wouldn’t be very fast, but it would work from any computer that I plug it into, without configuration. For things like drivers and base app installs on a new computer it would be plenty fast.

Yeah! You should go build that! I’d buy one. It should either cost about $200 and work with your free account, or cost about $50 and require a subscription! :grinning:

What are you waiting for?

Another use case, maybe a bit more work to implement, would be use it as the backend for something like MacFUSE (or FUSE once you get a Linux version) so I could have a filesystem where it looks like all the directories and files are right there local, but if I actually access one of them it has to go and sync it before I can actually read from the file.

Then I could have a few settings for the entire mount point, like how much real disk space it should try to use up before it starts unsyncing stuff that hasn’t been accessed in a while.

odrive Agent and CLI documentation

2 Likes