Using SVN to backup

Some basic examples of how to use SVN as a backup system.

Install SVN:

sudo apt-get install subversion

How to create a backup:

mkdir ~/backup
cd ~/backup
mkdir yourcomputername

Copy all the files and folders you want to backup to yourcomputername:

svn import https://svn.yoursvnserver.com:9443/svn/yoursvnfolder/yourcomputername

How to add everything in the folder to SVN:

cd ~/backup
svn add --force * --auto-props --parents --depth infinity -q

How to commit everything that was saved in the backup folder:

svn commit /home/yourusername/backup/yourcomputername -m "yourcomputername backup"

Recovering Backup from SVN Server:

mkdir ~/work
cd ~/work
svn checkout https://svn.yoursvnservername.com:9443/svn/yoursvnfolder/yourcomputername

Delete missing files from an svn source folder:
Original info from: https://stackoverflow.com/questions/9600382/svn-command-to-delete-all-locally-missing-files#

cd thefoldername
svn st | grep ! | cut -d! -f2| sed 's/^ *//' | sed 's/^/"/g' | sed 's/$/"/g' | xargs svn rm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.