We always have some files in the system that need to be backed up regularly. For example, Web pages, configuration files for some applications, and so on. In general, under the Linux system, we can use the TAR command to package some of the specified files into a single file. Under Windows systems, the WinRAR software can be used to achieve the same function. If you want to compress all the files in the D:/web directory into a single file, the command line is as follows:
WinRAR a-r-ibck Webtar d:/web/
For backup, there is usually a server dedicated to the backup files, such as using the FTP protocol for transmission. The command-line execution of FTP from Windows is as follows:
Ftp-s:myscript.scr
Open 202.118.227.1
Michael
yyxx3.0_2
CD backup put
Webtar.rar
quit
Finally, you can automatically back up your script by putting it into the automatic execution of Windows.
The complete example is as follows:
=======================================
@echo off
Rem
REM defines some parameters
Rem
Set Version=written by Michaelzheng, 2005.09.14, v0.3
Set Dest=e:/backups/datas
Set Dest_uedit=%dest%/ultraedit
Set Dest_unispim=%dest%/unispim
Set Dest_radmin=%dest%/radmin
Set Dest_favorites=%dest%/favorites
REM If you use the parameter--version, only the version information is output
If "%1" = = "--version" goto label_about
Echo **************************************************************
echo This script backs up some green software profiles used to collect system information before reloading the system
Echo%version%
Echo **************************************************************
The echo configuration file will be backed up to the%dest% directory
: Label_normal
mkdir%dest%
mkdir%dest_uedit%
mkdir%dest_unispim%
mkdir%dest_radmin%
mkdir%dest_favorites%
Echo.
echo Copy ultraedit configuration file to%dest_uedit% directory
xcopy%systemroot%/uedit32.ini%dest_uedit%/s/h/y
Echo.
echo copy violet Input method font and configuration to%dest_unispim%
xcopy "%appdata%/unispim"%dest_unispim%/s/h/y
Echo.
echo Copy radmin-client configuration file to%dest_radmin% directory
Copy "%appdata%/radmin"%dest_radmin%
Echo.
echo Copy IE "Favorites" to%dest_favorites% directory
xcopy "%userprofile%/favorites"%dest_favorites%/s/h/y
Echo.
Echo **************************************************************
Echo backs up repository documents and Web scripts to ftp://202.118.227.1
Echo **************************************************************
Set Wiki_datas=d:/docs/wikis
Set Wiki_programs=d:/greensofts/jakarta-tomcat-5.5.9/webapps
Echo.
echo Delete old backup ...
Del Wiki-data-old.rar
Del Wiki-pro-old.rar
Rename Wiki-data.rar Wiki-data-old.rar
Rename Wiki-pro.rar Wiki-pro-old.rar
Echo.
Echo starts compressing, it may take a few minutes ...
WinRAR a-ibck wiki-data%wiki_datas%/*.txt
WinRAR a-r-ibck Wiki-pro%wiki_programs%/
Echo.
Echo begins to transfer to the remote computer ...
Ftp-s:ftp.scr
Goto Label_end
: Label_about
Echo%version%
Goto Label_end
: Label_end
Echo Backup Ended
Pause
REM%* will list all parameters,%1 lists the first parameter,%0 lists batch file names