Created
November 3, 2024 16:31
-
-
Save mrl22/e6592bbdac360716be7964dbdf709ac1 to your computer and use it in GitHub Desktop.
Multithreaded recursive upload to dropbox using dbxcli with resume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uploads everything in the current directory to Dropbox UPLOAD directory (change line 7) | |
# Configured for 2 threads, any more and you get api throttling errors | |
find . -type f -print0 | xargs -0 -n 1 -P 2 -I {} sh -c ' | |
file="{}" | |
log_file="uploaded_files.log" | |
dropbox_path="UPLOAD${file#.}" | |
# Check if file is already in log | |
if grep -qxF "$file" "$log_file"; then | |
echo "Skipping already uploaded file: $file" | |
else | |
# Echo and upload, then log the file on success | |
echo "dbxcli put \"$file\" \"$dropbox_path\"" | |
if dbxcli put "$file" "$dropbox_path"; then | |
echo "$file" >> "$log_file" | |
else | |
echo "Failed to upload: $file" >&2 | |
fi | |
fi | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment