This commit is contained in:
Luk
2024-09-14 12:13:01 +08:00
parent 9992fb331a
commit c23af842fd
6 changed files with 177 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui"
echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit"
read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ]
then
@@ -10,26 +10,55 @@ then
if [ "$ACTION_TYPE" = 's' ]
then
RC_CMD='sync'
elif [ ]
elif [ "$ACTION_TYPE" = 'c' ]
then
RC_CMD='copy'
fi
read -p "rclone $RC_CMD from source >>> " SOURCE_PATH
read -p "rclone $RC_CMD into target >>> " TARGET_PATH
# read -p "rclone $RC_CMD with max-age >>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件
read -p "rclone $RC_CMD excluding (folders must end with /) >>> " EXCLUDING
echo
echo "=== from source (default ./)"; read -p ">>> " SOURCE_PATH; if [ ! "$SOURCE_PATH" ]; then SOURCE_PATH="./"; fi
echo
while [ ! "$TARGET_PATH" ]
do
echo "=== to target [remote:path]"
read -p ">>> " TARGET_PATH
done
# read -p "rclone $RC_CMD with max-age >>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件
echo
echo "excluding files and folders (folders must end with /)"
read -p ">>> " EXCLUDING;
echo
echo "with [number] files in parallel, default 4"
read -p ">>> " TRANSFERS;
if [ ! "$TRANSFERS" ]; then TRANSFERS=4; fi
echo
echo "with [number] threads simultaneously, default 4";
read -p ">>> " THREADS;
if [ ! "$THREADS" ]; then THREADS=4; fi
FULL_CMD="rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --transfers=$TRANSFERS --multi-thread-streams=$THREADS --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}"
echo
echo "*****************************"
echo "rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}"
echo $FULL_CMD
echo "*****************************"
echo
echo "Starting? [y] for yes, [anything else] for quit"
read -p ">>> " YES_OR_NOT
echo
if [ "$YES_OR_NOT" = 'y' ]
then
echo "****************** [rclone $RC_CMD] Start: `date -u -Iseconds` *****************"
rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}
$FULL_CMD
echo "****************** [rclone $RC_CMD] Start: `date -u -Iseconds` *****************"
echo
rclone ls $TARGET_PATH
fi
elif [ "ACTION_TYPE" = 'w' ]
then