【批處理】同步文件到服務器

前提:

1、已安裝FastCopy.exe

2、在服務器上共享文件夾,並能訪問,如 \\JCXMB\share_JC\

代碼如下:


setlocal ENABLEDELAYEDEXPANSION

set "fc=D:\FastCopy\FastCopy.exe"
set "logFile=F:\sync_JC.log"
set "timestampFile=F:\錦採\timestamp.txt"
set "fromFolder=F:\錦採\*"
set "toFolder=\\JCXMB\share_JC\"

>nul ping JCXMB -n 1
if !errorlevel! equ 0 (
   >>%timestampFile% echo %date% %time%
   %fc% /cmd=sync /auto_close /verify /filelog=%logFile% %fromFolder% /to=%toFolder%
)

官方說明如下: 

/cmd=sync     Sync (Size/date),同步大小、日期不同的文件。
/auto_close   Close automatically after execution is finished with no errors.
/verify       Verify written files data by xxHash(MD5/SHA-1/SHA-256) (to disable, /verify=FALSE)
/filelog      Write to the filelog(detail of copy/delete files). 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章