Skip to content

Commit

Permalink
add support for vertical switches in config file, add param --config-…
Browse files Browse the repository at this point in the history
…exclude
  • Loading branch information
aetonsi committed Sep 2, 2022
1 parent 059a85b commit 7ef8c4d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
9 changes: 9 additions & 0 deletions config/exclude.txt.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--exclude="/System Volume Information/**"
--exclude="/$RECYCLE.BIN/**"
--exclude=desktop.ini
--exclude=Thumbs.db
--exclude=logs/**
--exclude=vendor/**
--exclude=node_modules/**
--exclude=.git/**
--exclude=.svn/**
14 changes: 13 additions & 1 deletion config/switches.txt.sample
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
--exclude=vendor --exclude=node_modules --exclude=.git --exclude=.svn --exclude=desktop.ini --exclude "/System Volume Information/**" --exclude "/$RECYCLE.BIN/**" --exclude=Thumbs.db --delete-excluded --progress --verbose --copy-links --create-empty-src-dirs --retries 6 --retries-sleep 30s --stats 60s --stats-file-name-length 0 --buffer-size 32M --tpslimit 10 --transfers 2 --bwlimit 1300k
--delete-excluded
--progress
--verbose
--copy-links
--create-empty-src-dirs
--retries=6
--retries-sleep=30s
--stats=60s
--stats-file-name-length=0
--buffer-size=32M
--tpslimit=10
--transfers=2
--bwlimit=1300k
14 changes: 13 additions & 1 deletion config/switches_light.txt.sample
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
--exclude=vendor --exclude=node_modules --exclude=.git --exclude=.svn --exclude=desktop.ini --exclude "/System Volume Information/**" --exclude "/$RECYCLE.BIN/**" --exclude=Thumbs.db --delete-excluded --progress --verbose --copy-links --create-empty-src-dirs --retries 6 --retries-sleep 30s --stats 60s --stats-file-name-length 0 --buffer-size 32M --tpslimit 10 --transfers 2 --bwlimit 200k
--delete-excluded
--progress
--verbose
--copy-links
--create-empty-src-dirs
--retries=6
--retries-sleep=30s
--stats=60s
--stats-file-name-length=0
--buffer-size=32M
--tpslimit=10
--transfers=2
--bwlimit=200k
30 changes: 24 additions & 6 deletions rclapper.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set "CONFIG_RCLONE=config\rclone.config.ini"
set "CONFIG_JOBS=config\jobs.txt"
set "CONFIG_REMOTES=config\remotes.txt"
set "CONFIG_SWITCHES=config\switches.txt"
set "CONFIG_EXCLUDE=config\exclude.txt"
set "CONFIG_MINUTES=config\minutes.txt"

set "TOOL_TEE=tee"
Expand Down Expand Up @@ -58,6 +59,12 @@ if "%~1" EQU "--config-switches" (
shift
goto :parseArgs
)
if "%~1" EQU "--config-exclude" (
set "CONFIG_EXCLUDE=%~2"
shift
shift
goto :parseArgs
)
if "%~1" EQU "--config-minutes" (
set "CONFIG_MINUTES=%~2"
shift
Expand All @@ -76,6 +83,13 @@ if not exist "%CONFIG_SWITCHES%" (
echo.>"%CONFIG_SWITCHES%"
)
)
if not exist "%CONFIG_EXCLUDE%" (
if exist "%CONFIG_EXCLUDE%.sample" (
type "%CONFIG_EXCLUDE%.sample">"%CONFIG_EXCLUDE%"
) ELSE (
echo.>"%CONFIG_EXCLUDE%"
)
)
if not exist "%CONFIG_MINUTES%" (
if exist "%CONFIG_MINUTES%.sample" (
type "%CONFIG_MINUTES%.sample">"%CONFIG_MINUTES%"
Expand All @@ -89,11 +103,11 @@ echo CONFIG_RCLONE = %CONFIG_RCLONE%
echo CONFIG_JOBS = %CONFIG_JOBS%
echo CONFIG_REMOTES = %CONFIG_REMOTES%
echo CONFIG_SWITCHES = %CONFIG_SWITCHES%
echo CONFIG_EXCLUDE = %CONFIG_EXCLUDE%
echo CONFIG_MINUTES = %CONFIG_MINUTES%


rem ====== main function
for /F "usebackq tokens=*" %%A in ("%CONFIG_SWITCHES%") do set SWITCHES=%%A
if not defined NOLOG (
if not defined TEEING (
where /q tee
Expand All @@ -117,20 +131,24 @@ if not defined NOLOG (
)
)
)
echo.
echo Starting in 10 seconds...
timeout /t 10
echo.

for /F "usebackq tokens=*" %%A in ("%CONFIG_SWITCHES%") do set "SWITCHES=!SWITCHES! %%A"
for /F "usebackq tokens=*" %%A in ("%CONFIG_EXCLUDE%") do set "SWITCHES_EXCLUDE=!SWITCHES_EXCLUDE! %%A"
:redo
call :fn_title
echo ====================================
echo ====================================
echo STARTED @ %DT%
chcp 65001
echo picked up SWITCHES=!SWITCHES!
echo picked up SWITCHES_EXCLUDE=!SWITCHES_EXCLUDE!
echo ====================================
echo ====================================
echo.
echo.
echo Starting in 10 seconds...
timeout /t 10
echo.

for /F "delims=| tokens=1,2,3,4 usebackq" %%A in ("%CONFIG_JOBS%") do (
for /F "tokens=* usebackq" %%R in ("%CONFIG_REMOTES%") do (
Expand All @@ -140,7 +158,7 @@ for /F "delims=| tokens=1,2,3,4 usebackq" %%A in ("%CONFIG_JOBS%") do (
rem %%D=remote suffix [optional]
rem %%B=remote dir
set "cmd1=!TOOL_RCLONE! --config=%CONFIG_RCLONE% dedupe --dedupe-mode rename --by-hash %%~C%%~R%%~D:%%B"
set "cmd2=!TOOL_RCLONE! --config=%CONFIG_RCLONE% sync !SWITCHES! %%A %%~C%%~R%%~D:%%B"
set "cmd2=!TOOL_RCLONE! --config=%CONFIG_RCLONE% sync !SWITCHES_EXCLUDE! !SWITCHES! %%A %%~C%%~R%%~D:%%B"
echo ====================================
echo !cmd1!
echo !cmd2!
Expand Down

0 comments on commit 7ef8c4d

Please sign in to comment.