Last active
June 14, 2021 11:22
-
-
Save yamatt/c6aafb43e85c08889e2577b5149d8f06 to your computer and use it in GitHub Desktop.
Upload a bunch of files over time
This file contains hidden or 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
#!/bin/bash | |
if [ -z "$1" ]; then | |
WD="$CWD" | |
else | |
WD="$1" | |
fi | |
readarray -d '' FILES < <(find $WD -type f -print0) | |
# iterate through array using a counter | |
for ((i=0; i<${#FILES[@]}; i++)); do | |
day=$(($i + 1)) | |
FILE_PATH="${FILES[$i]}" | |
FILE_NAME=$(basename "$FILE_PATH") | |
echo b2 upload-file bucket \""$FILE_PATH"\" \""$FILE_NAME"\" | at 1am + $day days | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment