Showing posts with label 7-zip. Show all posts
Showing posts with label 7-zip. Show all posts

Wednesday, April 16, 2008

Backup folders with 7-zip command line

The 7-zip command line can be used to do a multiple folders backup. The good thing with 7-zip is that it support many compression method such as bzip2, gzip, zip and of course 7z.

Here are steps for doing a backup on multiple folders on Windows:
  1. Download the 7-zip Command Line Version from http://www.7-zip.org/download.html.

  2. Extract the content of the zip file to a temporary folder.

  3. Copy 7za.exe to your system folder (for example C:\Windows\System32 for Windows XP).

  4. Create a folder for your backup, for example C:\backup.

  5. Create a text file in the C:\backup folder and name it backup.txt.

  6. List the full path of the folders that will be backup, each on a new line.

  7. Create a batch file in C:\backup folder and name it backup.bat.

  8. In the backup.bat file, type
    7za u backup -up1q3r2x1y2z1w2 @backup.txt

To back up, just double click the backup.bat file. A command prompt will be opened and closed automatically when the backup process end.

As a result, you will get a backup file named backup.7z. The u command will instruct 7-zip to update the content of the backup.7z file or create a new one if backup.7z does not exist.

If you don't like the 7z compression method and would like to use the zip compression method instead, just add -tzip switch after the u command.
7za u -tzip backup @backup.txt

Now, the backup file that will be created is backup.zip.

To automatically run a backup at a specific time, please use the Scheduled Tasks feature for Windows XP.