Skip to content

Instantly share code, notes, and snippets.

@SterlingButters
Created April 12, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SterlingButters/11c132d757304d4a1262c3453d0d8583 to your computer and use it in GitHub Desktop.
Save SterlingButters/11c132d757304d4a1262c3453d0d8583 to your computer and use it in GitHub Desktop.
Recursively Syncs oDrive Directories and SubDirectories starting from pwd
#!/bin/bash
handle_directory(){
for filename in "$1"/*; do
if [[ "$filename" = *.cloud ]]; then
echo "File[$filename] not synced"
/usr/bin/python /home/sterlingbutters/.odrive-agent/bin/odrive.py sync "$filename"
elif [[ "$filename" = *.cloudf ]]; then
echo "File[$filename] not synced"
/usr/bin/python /home/sterlingbutters/.odrive-agent/bin/odrive.py sync "$filename"
elif [ -d "$filename" ]; then
echo "[$filename] is a directory"
handle_directory "$filename"
else
echo "Skipping File[$filename]: (Already Synced)"
fi
done
}
for filename in ./*; do
if [[ "$filename" = *.cloud ]]; then
echo "File[$filename] not synced"
/usr/bin/python /home/sterlingbutters/.odrive-agent/bin/odrive.py sync "$filename"
elif [[ "$filename" = *.cloudf ]]; then
echo "File[$filename] not synced"
/usr/bin/python /home/sterlingbutters/.odrive-agent/bin/odrive.py sync "$filename"
elif [ -d "$filename" ]; then
echo "[$filename] is a directory"
handle_directory "$filename"
else
echo "Skipping File[$filename]: (Already Synced)"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment