Hi, I am currently backing up a few Linux boxes, and a Windows XP box, using rsync (through a cron job). Regarding the Windows box ( Windows XP (running Cygwin) <--> Debian Testing), so far I specify a few directories as sources in the rsync command line. I then use an excludes file to include certain directories and exclude others. I was wondering, can I just specify / as the source and specify the dirs that I want to include and leave everything out? (This would simplify my command line of rsync.) I have tried this as the excludes file (with source / in rsync command line): + */ + Documents and Setting/WinUser/My Documents + Documents and Setting/WinUser/Start Menu/ + Documents and Setting/WinUser/Recent/ + Documents and Setting/WinUser/Application Data/Mozilla/ + Documents and Setting/WinUser/Application Data/Thunderbird/ - * The idea is to backup only the directories mentioned above, and leave everything else out. But given these rules, nothing is backed up. I know this is a newbee questions, but I am trying this example based on the man page of rsync and seem to hitting this wall. All help is appreciated, ->HS
Matt McCutchen
2005-Dec-06 21:59 UTC
SRC=/, include a few directories and exclude everything else
On Tue, 2005-12-06 at 13:36 -0500, H.S. wrote:> + */ > + Documents and Setting/WinUser/My Documents > + Documents and Setting/WinUser/Start Menu/ > + Documents and Setting/WinUser/Recent/ > + Documents and Setting/WinUser/Application Data/Mozilla/ > + Documents and Setting/WinUser/Application Data/Thunderbird/ > > - * > > The idea is to backup only the directories mentioned above, and leave > everything else out. But given these rules, nothing is backed up.The five "Documents..." rules are only including those directories, not the files inside. Try this: + */ + Documents and Setting/WinUser/My Documents/** + Documents and Setting/WinUser/Start Menu/** + Documents and Setting/WinUser/Recent/** + Documents and Setting/WinUser/Application Data/Mozilla/** + Documents and Setting/WinUser/Application Data/Thunderbird/** - * The first rule includes all directories, and the next five include all the files recursively inside the five directories you want. If you don't like getting a thicket of directories in addition to the five trees you want, you can do something like this: + Documents and Setting + Documents and Setting/WinUser + Documents and Setting/WinUser/My Documents + Documents and Setting/WinUser/My Documents/** (etc.) Note that this matches each parent directory individually and then matches all the files in the tree. However, instead of using filters, it might be easier to collect the directories using --relative. Consider this command: cd / && rsync --relative "Documents and Setting/WinUser/"{"My Documents","Start Menu","Recent","Application Data/Mozilla","Application Data/Thunderbird"} backup/ This will create "/backup/Documents and Setting/WinUser/My Documents" and so forth. -- Matt McCutchen, ``hashproduct'' hashproduct@verizon.net -- http://hashproduct.metaesthetics.net/