Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report