Get the App
SLTechnology News&Howtos  ›  Servers  › 

2.2.2 solution compressed files are backed up to PC2 (LAN sharing and FTP uploading and downloading)

Shulou Source: shulou.com Published: 2022-06-02 07:52:57 10月03日 Update

Windows command line batcmd script application of automatic backup remote backup

2.2.2 Solution Compress file backup to PC2

requirement description

Environment: PC1: 192.168.1.201 PC2: 192.168.1.202

Two machines in a local area network;

PC1's C:\back generates a backup file every hour;

Now you need to backup files to PC2

Method 1: PC2 local area network read-write sharing

1.PC2 Settings Sharing

PC1 Connection Sharing

3. write scripts

copy file xcopy /y /s /d --copy non-empty directories and subdirectories, if encountered with duplicate names, the new overwrite the old;

set "name=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%"

Xcopy /y /s /d

4. scheduled task

Method 2: PC1 local area network read-only sharing (recommended)

PC1 Settings Sharing

PC2 Connection Sharing

3. write scripts

copy file xcopy /y /s /d --copy non-empty directories and subdirectories, if encountered with duplicate names, the new overwrite the old;

set "name=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%"

Xcopy /y /s /d

4. scheduled task

Method 3: FTP Download

PC1 Deploys FTP Server

2. write scripts

set "name=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%"

echo open 192.168.1.201>ftp.txt

echo fileaa>>ftp.txt

echo fileaa>>ftp.txt

echo mget %name%.zip>>ftp.txt

echo bye>>ftp.txt

ftp -i -s:ftp.txt >log.log

3. scheduled task

Method 4: FTP upload (recommended)

PC2 Deploys FTP Server

2. write scripts

set "name=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%"

7z a -tzip "%name%.zip" "C:\Windows Command Line Batcmd Script Application Automatic Backup Offsite Backup *"

echo open 192.168.1.202>ftp.txt

echo fileaa2>>ftp.txt

echo fileaa2>>ftp.txt

echo mput %name%.zip>>ftp.txt

echo bye>>ftp.txt

ftp -i -s:ftp.txt >log.log

3. scheduled task

Learn video tutorials

Tags: Backup script file task method local area local area network command subdirectory remote location copy server directory application recommendation service solution hour Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei vpn Docker Shulou Tech Info Xiaomi