📜 ⬆️ ⬇️

The script for the backup directory

There is an archive folder on one computer at work under Windows, the loss of which is similar to death. Without further ado for 15 minutes, I wrote a simple script that archives the directory and uploads it to the FTP server. Perhaps not the most elegant solution, but someone can help.

The 7z archiver is installed on the computer, which performs its duties, then we execute the ftp command, and as a parameter after the -s key, we transfer the text file ftp.txt lying in the same directory as the script (in this case, in the root of the C drive :)

cd c:\"Program files"\7-zip
# garbage backup.zip
7z a -tzip c:\backup.zip c:\garbage
cd \
# ftp
ftp -s:"ftp.txt"


')
But the contents of the file:

# IP ftp-
open 192.168.1.1
#
admin
#
admin
#
lcd c:\
#
put backup.zip
#
bye


Next, add the task to the scheduler and everything works.

Source: https://habr.com/ru/post/81001/


All Articles