For your backup and unsync use case, you can script something like this in bash:
#!/bin/bash
agentdir="$HOME/.odrive-agent/bin"
export agentdir
agentmount="$HOME/odrive/Dropbox (Personal)"
targetdir="$agentmount/temp"
sourcedir="$HOME/Downloads/test_directory"
python "$agentdir/odrive.py" sync "$targetdir.cloudf"
cp -R "$sourcedir" "$targetdir/"
python "$agentdir/odrive.py" refresh "$targetdir"
echo Waiting for odrive to start syncing $targetdir ...
while [ "$(python "$agentdir/odrive.py" syncstate "$targetdir" | head -n 1)" == "Synced" ]; do
sleep 5
done
echo odrive is syncing changes in $targetdir ...
while [ "$(python "$agentdir/odrive.py" syncstate "$targetdir" | head -n 1)" != "Synced" ]; do
find "$targetdir" ! -name '*.cloud*' -type file -exec bash -c 'thepath="$1"
echo "$(python "$agentdir/odrive.py" syncstate "$thepath" | head -n 1)"
if [[ "$(python "$agentdir/odrive.py" syncstate "$thepath" | head -n 1)" == "Synced" ]]; then
echo "$thepath" is synced! Unsyncing...
python "$agentdir/odrive.py" unsync "$thepath"
fi
' _ {} \;
sleep 5
done
echo Sync complete! Unsyncing $targetdir ...
python "$agentdir/odrive.py" unsync "$targetdir"
This will first sync the target directory residing inside the agent mount (since it is assumed that it is starting in an unsynced state) and then copy a source directory into the target directory. It will then wait until syncing starts. Once syncing starts, it will begin looking for files that have finished syncing and unsync them if they have. At the end it unsyncs the whole target directory.
I did this quick and only tested a couple of times on OS X, so think of it more as a starting point, but it may get you to a simple solution. It does do some polling, but it it isn’t a problem.