SHARE
TWEET

Untitled

a guest Aug 8th, 2019 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM Make source and dest identical, modifying destination only
  2. REM Destination is updated to match source, including deleting files if necessary
  3. REM If dest:path doesn’t exist, it is created and the source:path contents go there
  4. REM Doesn’t transfer unchanged files, testing by size and modification time or MD5SUM
  5. @ECHO OFF
  6.  
  7. REM Configuration variables
  8. SET RCLONE_EXE_PATH="C:\rclone\rclone.exe"
  9. SET RCLONE_CONFIG_PATH="C:\RCLONESYNC\rclone.conf"
  10. SET RCLONE_LOG_FILE_PATH="C:\RCLONESYNC\rclone-sync-log.txt"
  11. REM Log level : DEBUG|INFO|NOTICE|ERROR (default NOTICE)
  12. SET RCLONE_LOG_LEVEL=DEBUG
  13. REM Read filters from file
  14. SET RCLONE_FILTER_FILE_PATH="C:\RCLONESYNC\rclone-filters.txt"
  15. REM Number of checkers to run in parallel (default 8)
  16. SET RCLONE_CHECKERS_NUMBER=10
  17. REM Number of file transfers to run in parallel (default 4)
  18. SET RCLONE_FILE_TRANSFERS_NUMBER=10
  19. REM Number of low level retries to do (default 10)
  20. SET RCLONE_LOW_LEVEL_RETRIES_NUMBER=10
  21. REM Retry operations this many times if they fail (default 3)
  22. SET RCLONE_RETRIES_NUMBER=10
  23. REM Interval between retrying operations if they fail, e.g 500ms, 60s, 5m (0 to disable)
  24. SET RCLONE_RETRIES_SLEEP=5s
  25. REM Paths
  26. SET RCLONE_LOCAL_PATH=Z:\
  27. SET RCLONE_REMOTE_PATH=gdrive:/BACKUP/
  28. REM Local directory names to sync, comma separated
  29. SET RCLONE_DIRECTORIES_TO_SYNC=test,ШАБЛОНЫ,КАТЯ,Софья
  30. REM Additional rclone flags
  31. SET RCLONE_ADDITIONAL_FLAGS=--delete-excluded --progress --stats-one-line --tpslimit 10
  32.  
  33. REM Console height / width
  34. MODE 80,25 | ECHO off
  35. REM Console title
  36. TITLE rclone-sync
  37.  
  38. ECHO.
  39. REM If password is not passed as argument
  40. IF [%1] == [] (
  41.     REM Ask for rclone config password
  42.     SET /p RCLONE_CONFIG_PASSWORD="> Config password : "
  43. ) ELSE (
  44.     SET RCLONE_CONFIG_PASSWORD=%1
  45. )
  46.  
  47. REM If shutdown / hibernate is not passed as argument
  48. IF [%2] == [] (
  49.     REM Shutdown?
  50.     SET /p SHUTDOWN_AFTER_SYNC="> Shutdown after sync? [y/n] : "
  51.     REM Hibernate?
  52.     SET /p HIBERNATE_AFTER_SYNC="> Hibernate after sync? [y/n] : "
  53. )
  54.  
  55. CLS
  56.  
  57. ECHO.
  58. ECHO ^> Sync :
  59. ECHO.
  60.  
  61. SETLOCAL
  62.     SET RCLONE_CONFIG_PASS=%RCLONE_CONFIG_PASSWORD%
  63.    
  64.     FOR %%A IN (%RCLONE_DIRECTORIES_TO_SYNC%) DO (
  65.         ECHO  - %RCLONE_LOCAL_PATH%%%A -^> %RCLONE_REMOTE_PATH%%%A
  66.         @ECHO %date%;%time%;%%A;start>> %RCLONE_LOG_FILE_PATH%
  67.         %RCLONE_EXE_PATH% sync "%RCLONE_LOCAL_PATH%%%A" "%RCLONE_REMOTE_PATH%%%A" --config=%RCLONE_CONFIG_PATH% --filter-from=%RCLONE_FILTER_FILE_PATH% %RCLONE_ADDITIONAL_FLAGS% --log-file=%RCLONE_LOG_FILE_PATH% --log-level %RCLONE_LOG_LEVEL% --transfers=%RCLONE_FILE_TRANSFERS_NUMBER% --checkers %RCLONE_CHECKERS_NUMBER% --low-level-retries %RCLONE_LOW_LEVEL_RETRIES_NUMBER% --retries %RCLONE_RETRIES_NUMBER% --retries-sleep %RCLONE_RETRIES_SLEEP%
  68.         @ECHO %date%;%time%;%%A;end>> %RCLONE_LOG_FILE_PATH%
  69.     )
  70. ENDLOCAL
  71.  
  72. REM If "shutdown" is passed as argument
  73. IF [%2] == [shutdown] (
  74.     REM Shutdown computer
  75.     shutdown -s -f
  76. )
  77. IF "%SHUTDOWN_AFTER_SYNC%"=="y" (
  78.     SET SHUTDOWN_AFTER_SYNC=
  79.     shutdown -s -f
  80. )
  81.  
  82. REM If "hibernate" is passed as argument
  83. IF [%2] == [hibernate] (
  84.     REM Hibernate computer
  85.     shutdown -h
  86. )
  87. IF "%HIBERNATE_AFTER_SYNC%"=="y" (
  88.     SET HIBERNATE_AFTER_SYNC=
  89.     shutdown -h
  90. )
  91.  
  92. REM Wait 10 seconds, then exit script
  93. TIMEOUT 10 | ECHO off
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top