|
Creating and running a batch file for compressing directories
Creating and running a batch fileCreate a directory on your local hard disk where you want to store your compressed backups. E.g.: c:\backups Download the compression utility zip.exe the example batch file backup-daily.bat from here, and save and uncompress them in the backup directory. Open the file backup-daily.bat in the notepad editor and apply the changes as discussed below:
zip -ur backup-last.zip \\NETWIN\CESD\BBouman The above command runs the compression utility zip.exe starting from the directory \BBouman in the \\NETWIN\CESD repository. All files and sub-directories in \BBouman are compressed together into the local file backup-last.zip. The directory \BBouman is only an example, and you need to replace it with the path to the directory from where you want the backup to start. You need read access to the directories that you want back up. zip -ur backup-last.zip V:\BBouman If you have mapped the network drive and repository to a particular drive letter as shown below, you can use the drive letter and directory name.
copy backup-last.zip backup-%date%.zip
Discussionoptions for zip utility
When using the u option, files and folder that are deleted from the repository will still remain in the compressed backup. To avoid this accumulation, you can create a separate batch file backup-monthly.bat that makes a copy of all the recent files. del backup-last.zip zip -ur backup-last.zip \\NETWIN\CESD\BBouman copy backup-last.zip backup-%date%.zip The command del will delete the backup-last.zip file. Deleting will stop the file accumulation, thus creating a fresh version of the backup file. Depending on the number and size of files, this may cause considerable network traffic and should only be run occasionally, e.g. monthly. Note that you will need to change it in all places for the batch file to work properly.
Last modified April 21, 2008 5:57 am
|