creating directories not specified in '--files-from' file

Madison Kelly linux at
Fri Jul 29 00:19:26 GMT 2005

Hi all,

   I use 'rsync' in my backup program and I've run into an annoying bug. 
If I specify a directory to be backed up all files in it are copied 
automatically. This is a problem because a user may have selected 
specifically to not backup a given file. Also if a subdirectory exists 
in a specified directory it is also copied though do data below it is.

   I call 'rsync' via:

=- 'rsync' call -=
sudo -b /usr/bin/rsync -aq --modify-window=1 --no-whole-file --partial 
--files-from=/path/to/list.txt /boot /dest/path
=- 'rsync' call -=

   In the 'list.txt' file I have this:

=- 'list.txt' file -=
=- 'list.txt' file -=

   For example, I am testing my program by copying my '/boot' partition 
(because it is small) with a couple of test directories. One of those is 
'/boot/test/...' which, as you can see above, is not specified. I have 
also not specified the two 'config...' files also. When 'rsync' runs 
though this is what is created on the destination partition:

=- 'ls -lah' of destination directory -=
sudo ls -lah /dest/path
total 12M
drwxr-xr-x  6 root    root    4.0K 2005-07-15 18:35 .
drwxr-xr-x  3 madison madison 4.0K 2005-07-28 20:11 ..
-rw-r--r--  1 root    root     44K 2005-05-16 04:02 config-2.4.27-2-686
-rw-r--r--  1 root    root     55K 2005-05-19 04:51 config-2.6.8-2-686
drwxr-xr-x  2 root    root    4.0K 2005-07-04 21:23 grub
-rw-r--r--  1 root    root    4.0M 2005-07-04 15:46 initrd.img-2.4.27-2-686
-rw-r--r--  1 root    root    4.5M 2005-07-04 21:23 initrd.img-2.6.8-2-686
drwxr-xr-x  2 root    root    4.0K 2005-07-04 15:41 lost+found
-rw-r--r--  1 root    root    519K 2005-05-16 04:42
-rw-r--r--  1 root    root    824K 2005-05-19 05:27
drwxr-xr-x  2 root    root    4.0K 2005-07-24 11:03 test
drwxr-xr-x  3 root    root    4.0K 2005-07-15 18:35 test2
-rw-r--r--  1 root    root    856K 2005-05-16 04:41 vmlinuz-2.4.27-2-686
-rw-r--r--  1 root    root    1.2M 2005-05-19 05:27 vmlinuz-2.6.8-2-686
=- 'ls -lah' of destination directory -=

   This destination directory (partition) was blank before running 
'rsync' so any data there is solely because of 'rsync'. Is there a way 
to tell 'rsync' not to copy sub directories or files in a given 
directory listed in '--files-from=...' unless specifically asked to do so?

   Thanks in advance!


More information about the rsync mailing list