Skip to content

Commit 7ef8c4d

Browse files
committed
add support for vertical switches in config file, add param --config-exclude
1 parent 059a85b commit 7ef8c4d

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

config/exclude.txt.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--exclude="/System Volume Information/**"
2+
--exclude="/$RECYCLE.BIN/**"
3+
--exclude=desktop.ini
4+
--exclude=Thumbs.db
5+
--exclude=logs/**
6+
--exclude=vendor/**
7+
--exclude=node_modules/**
8+
--exclude=.git/**
9+
--exclude=.svn/**

config/switches.txt.sample

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
--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
1+
--delete-excluded
2+
--progress
3+
--verbose
4+
--copy-links
5+
--create-empty-src-dirs
6+
--retries=6
7+
--retries-sleep=30s
8+
--stats=60s
9+
--stats-file-name-length=0
10+
--buffer-size=32M
11+
--tpslimit=10
12+
--transfers=2
13+
--bwlimit=1300k

config/switches_light.txt.sample

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
--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
1+
--delete-excluded
2+
--progress
3+
--verbose
4+
--copy-links
5+
--create-empty-src-dirs
6+
--retries=6
7+
--retries-sleep=30s
8+
--stats=60s
9+
--stats-file-name-length=0
10+
--buffer-size=32M
11+
--tpslimit=10
12+
--transfers=2
13+
--bwlimit=200k

rclapper.cmd

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set "CONFIG_RCLONE=config\rclone.config.ini"
66
set "CONFIG_JOBS=config\jobs.txt"
77
set "CONFIG_REMOTES=config\remotes.txt"
88
set "CONFIG_SWITCHES=config\switches.txt"
9+
set "CONFIG_EXCLUDE=config\exclude.txt"
910
set "CONFIG_MINUTES=config\minutes.txt"
1011

1112
set "TOOL_TEE=tee"
@@ -58,6 +59,12 @@ if "%~1" EQU "--config-switches" (
5859
shift
5960
goto :parseArgs
6061
)
62+
if "%~1" EQU "--config-exclude" (
63+
set "CONFIG_EXCLUDE=%~2"
64+
shift
65+
shift
66+
goto :parseArgs
67+
)
6168
if "%~1" EQU "--config-minutes" (
6269
set "CONFIG_MINUTES=%~2"
6370
shift
@@ -76,6 +83,13 @@ if not exist "%CONFIG_SWITCHES%" (
7683
echo.>"%CONFIG_SWITCHES%"
7784
)
7885
)
86+
if not exist "%CONFIG_EXCLUDE%" (
87+
if exist "%CONFIG_EXCLUDE%.sample" (
88+
type "%CONFIG_EXCLUDE%.sample">"%CONFIG_EXCLUDE%"
89+
) ELSE (
90+
echo.>"%CONFIG_EXCLUDE%"
91+
)
92+
)
7993
if not exist "%CONFIG_MINUTES%" (
8094
if exist "%CONFIG_MINUTES%.sample" (
8195
type "%CONFIG_MINUTES%.sample">"%CONFIG_MINUTES%"
@@ -89,11 +103,11 @@ echo CONFIG_RCLONE = %CONFIG_RCLONE%
89103
echo CONFIG_JOBS = %CONFIG_JOBS%
90104
echo CONFIG_REMOTES = %CONFIG_REMOTES%
91105
echo CONFIG_SWITCHES = %CONFIG_SWITCHES%
106+
echo CONFIG_EXCLUDE = %CONFIG_EXCLUDE%
92107
echo CONFIG_MINUTES = %CONFIG_MINUTES%
93108

94109

95110
rem ====== main function
96-
for /F "usebackq tokens=*" %%A in ("%CONFIG_SWITCHES%") do set SWITCHES=%%A
97111
if not defined NOLOG (
98112
if not defined TEEING (
99113
where /q tee
@@ -117,20 +131,24 @@ if not defined NOLOG (
117131
)
118132
)
119133
)
120-
echo.
121-
echo Starting in 10 seconds...
122-
timeout /t 10
123-
echo.
134+
135+
for /F "usebackq tokens=*" %%A in ("%CONFIG_SWITCHES%") do set "SWITCHES=!SWITCHES! %%A"
136+
for /F "usebackq tokens=*" %%A in ("%CONFIG_EXCLUDE%") do set "SWITCHES_EXCLUDE=!SWITCHES_EXCLUDE! %%A"
124137
:redo
125138
call :fn_title
126139
echo ====================================
127140
echo ====================================
128141
echo STARTED @ %DT%
129142
chcp 65001
130143
echo picked up SWITCHES=!SWITCHES!
144+
echo picked up SWITCHES_EXCLUDE=!SWITCHES_EXCLUDE!
131145
echo ====================================
132146
echo ====================================
133147
echo.
148+
echo.
149+
echo Starting in 10 seconds...
150+
timeout /t 10
151+
echo.
134152

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

0 commit comments

Comments
 (0)