Share two of your own bat scripts that automatically synchronize files under Windows (Tiger O (∩_∩) o)
*******************************************************************
@echo off
Color 02
REM uses Goto and lftp to implement timed automatic uploading of files to the FTP server specified directory # #注释信息
: Loop
Echo.
Echo.
Echo =============================================
echo Start copy File after 5 second
TIMEOUT/T 5 # #每5秒复制一下
Echo Copying File ...
Lftp-f/cygdrive/Drive letter/directory/lftp.txt # f is the file path that specifies the lftp execution command
echo "Success"
Pause
Goto:loop
Lftp.txt # #这个文件里面的命令在上面lftp-F command can be called wherever you can write the corresponding path is OK
Open 10.0.2.168
User Cienet Cienet
Put/cygdrive/f/index/file.txt-o data/##/cygdrive/f/index is the path to the file to be uploaded in the index directory of the local F-drive-O is the corresponding directory to upload to FTP
Note: The lftp is used here because the FTP command does not seem to support passive mode, and I have lftp configured in the system environment variable
*******************************************************************
@echo off
Color 02
REM uses Goto and if to determine if a shared file exists and automatically copies files at regular intervals
Goto Start
: Start
Echo.
Echo.
Echo =============================================
echo Start copy File after 5 second
TIMEOUT/T 5
NET use \ \ shared ip\ shared directory "password"/user: Shared account # #访问共享
If exist file.txt goto COPY1 # # If the file.txt file exists then execute the command under copy1 otherwise execute the command under COPY2
Goto COPY2
: Copy1
Echo.
echo No File
TIMEOUT/T 2
Goto EOF # Exit script if no files are specified in the share to be copied
: Copy2
Echo.
Echo Copying File ...
NET use \ \ shared ip\ shared directory "password"/user: Shared account
xcopy \ \ Share ip\ shared directory \file.txt d:\/y
Goto Start # #跳回到start重新开始
: EOF
***************************************************************
This article is from the "Stop fleeting lb" blog, please be sure to keep this source http://liubin0505star.blog.51cto.com/5550456/1665095
A small script that automatically synchronizes files under Windows