Having a laptop that's on it's last legs, I'm looking at backing up my home directory.
However, I don't want to backup all the cruft that has accumulated there.
Rsync has a useful option to exclude a list of named directories: --exclude-from file.txt, where file.txt contains the list of files and directories to exclude.
So this is the procedure:
1. Perform a dry-run to investigate which cruft should be removed (-n indicates a dry-run):
e.g., rsync -avzn --exclude-from exclude.txt $source_dir $destination_dir
2. Add crufty patterns to exclude.txt:
3. Repeat until satisfied
4. Run actual rsync, e.g. rsync -az --exclude-from exclude-txt $source_dir $destination_dir
e.g.
% cat exclude.txt
.m2
.adobe
.bak
.cache
.config/chromium
.config/evolution
.config/google-chrome
.config/.libreoffice
.config/libreoffice
.dbvis
.eclipse
.freerdp
.Foxit
.gconf
.gimp*
.git
.gitignore
.ies4linux
.ivy2
.java
.macromedia
.moc
.mozilla
.multimedia
.opera
.pki
.pulse
.rdesktop
.squirrel-sql
.Skype
.swt
.vim
.vimperator
.thumbnails
.thunderbird
.w3m
.wine32
.wine64
.wireshark
.zcompcache
Desktop
Maildir
tmp
workspace
No comments:
Post a Comment