Hi, I'm trying to copy some directories with rsync and would like to delete files from the destination if they no longer exist in the source. I'm using the following command: rsync -v --archive --hard-links --delete --force --filter=':/.rsync-filter' /opt/ /mnt/backup/opt/ /opt does not contain any files the destination contains one file stewart at attobeast:/etc$ ls /mnt/backup/opt/ test-file after running the rsync command I would expect test-file to have been deleted but it isn't. I'm sure I'm missing something obvious in the man page that explains this behaviour but I can't figure it out. Can anyone enlighten me? Thanks Stewart
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is there any output? How about with an additional -v ? Is there a .rsync-filter file anywhere? On 01/28/13 17:02, Stewart Jeacocke wrote:> Hi, > > I'm trying to copy some directories with rsync and would like to > delete files from the destination if they no longer exist in the > source. > > I'm using the following command: > > rsync -v --archive --hard-links --delete --force > --filter=':/.rsync-filter' /opt/ /mnt/backup/opt/ > > /opt does not contain any files the destination contains one file > > stewart at attobeast:/etc$ ls /mnt/backup/opt/ test-file > > after running the rsync command I would expect test-file to have > been deleted but it isn't. I'm sure I'm missing something obvious > in the man page that explains this behaviour but I can't figure it > out. Can anyone enlighten me? > > Thanks > > Stewart >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlEG/5MACgkQVKC1jlbQAQcJhgCgoi+YfzaiheVg9HUP9TNBUs+d RFAAn3Q0vI3Lm2Wb7lQz8A4P96eTzXfj =C/YF -----END PGP SIGNATURE-----
At 22:02 28.01.2013 +0000, Stewart Jeacocke wrote:>Hi, > >I'm trying to copy some directories with rsync and would like to >delete files from the destination if they no longer exist in the >source. > >I'm using the following command: > >rsync -v --archive --hard-links --delete --force >--filter=':/.rsync-filter' /opt/ /mnt/backup/opt/ > >/opt does not contain any files >the destination contains one file > >stewart at attobeast:/etc$ ls /mnt/backup/opt/ >test-file > >after running the rsync command I would expect test-file to have been >deleted but it isn't. I'm sure I'm missing something obvious in the >man page that explains this behaviour but I can't figure it out. Can >anyone enlighten me?I'd say you have to give the parent folder as source to detect missing files: rsync ... /opt /mnt/backup/ Note the missing backslash of /opt. bye Fabi
>>On 01/28/13 17:02, Stewart Jeacocke wrote: >> I'm trying to copy some directories with rsync and would like to >> delete files from the destination if they no longer exist in the >> source. >> >> I'm using the following command: >> >> rsync -v --archive --hard-links --delete --force >> --filter=':/.rsync-filter' /opt/ /mnt/backup/opt/ >> >> /opt does not contain any files the destination contains one file >> >> stewart at attobeast:/etc$ ls /mnt/backup/opt/ test-file >> >> after running the rsync command I would expect test-file to have >> been deleted but it isn't. I'm sure I'm missing something obvious >> in the man page that explains this behaviour but I can't figure it >> out. Can anyone enlighten me?>On 01/28/13 15:45:39 MST, Kevin Korb wrote: >Is there any output? How about with an additional -v ? >Is there a .rsync-filter file anywhere?Thanks for your help Kevin. Adding -v -v revealed it was a .rysnc-filter file that was causing the mischief attobeast:/# rsync -v -v --archive --hard-links --delete --force --filter=': /.rsync-filter' /opt/ /mnt/backup/opt/ sending incremental file list delta-transmission disabled for local transfer or --whole-file [generator] protecting file test-file because of pattern /mnt/*/** [per-dir .rsync-filter] total: matches=0 hash_hits=0 false_alarms=0 data=0 sent 29 bytes received 15 bytes 88.00 bytes/sec total size is 0 speedup is 0.00 changing to using --delete-excluded made rsync behave in the way I wanted