One for the Rsync guru's

Associate
Joined
19 Jun 2003
Posts
1,680
Location
West Yorks, UK
Hi,
Struggling with something in Rsync at the moment. I'm issuing the following command:

Code:
rsync -avz --delete --files-from=includes.txt --exclude-from=excludes.txt / /backup

Includes.txt contains:
Code:
/home/folder1
/home/folder2
/home/folder3

So that will happily backup the above three folders to /backup, and will delete any files in the destination that don't exist in the source anymore. However, if I remove /home/folder3 from the includes.txt list, the folder isn't deleted from /backup (note: /home/folder3 isn't added to the excludes.txt list, as it would be too cumbersome to maintain a big list).

Is there anyway round this - can i force Rsync to delete folders on the destination that don't exist on the source, when the data is being fed in with --files-from?

Cheers,
Matt
 
Couple of related thoughts: the --force option (force deletion of dirs even if not empty) might do what you need, and -a doesn't imply recursion when you're also using --files-from which may result in undesired behaviour.
 
Back
Top Bottom