DO NOT REPLY [Bug 3825] New: rsync won't delete directory with
excluded files
samba-bugs at samba.org
samba-bugs at samba.org
Tue Jun 6 20:23:32 GMT 2006
https://bugzilla.samba.org/show_bug.cgi?id=3825
Summary: rsync won't delete directory with excluded files
Product: rsync
Version: 2.6.8
Platform: x86
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P3
Component: core
AssignedTo: wayned at samba.org
ReportedBy: vanes002 at umn.edu
QAContact: rsync-qa at samba.org
A full rsync was initially done. Later, some --exclude rules for temporary and
scratch files were added to the backup script.
If a directory contains a file that is now being excluded and the source
directory is deleted, the target directory will be cleaned up but the excluded
file will be left behind and the directory won't be deleted.
Furthermore, -n/--dry-run shows that rsync *wants* to delete the directory.
This behavior exists in 2.6.8 and in 2.6.3 (didn't test any others).
The desired behavior is that a directory deleted on the source should be
deleted on the target even if it has excluded files in it (i.e. imply
--delete-excluded just for the deleted hierarchy).
(I can't use the --delete-excluded option in the script because this backup is
done is several pieces, with the top-level backup having excludes for the
hierarchies done separately.)
Demo script:
rm -rf /tmp/rsync_src /tmp/rsync_dst
mkdir /tmp/rsync_src /tmp/rsync_dst
mkdir /tmp/rsync_src/dir
echo txt >/tmp/rsync_src/dir/file.txt
echo tmp >/tmp/rsync_src/dir/file.tmp
echo
echo '$' \
rsync -va /tmp/rsync_src/ /tmp/rsync_dst/
rsync -va /tmp/rsync_src/ /tmp/rsync_dst/
rm -rf /tmp/rsync_src/dir
echo
echo '$' \
rsync --exclude=file.tmp --delete -van /tmp/rsync_src/ /tmp/rsync_dst/
rsync --exclude=file.tmp --delete -van /tmp/rsync_src/ /tmp/rsync_dst/
echo
echo '$' \
rsync --exclude=file.tmp --delete -va /tmp/rsync_src/ /tmp/rsync_dst/
rsync --exclude=file.tmp --delete -va /tmp/rsync_src/ /tmp/rsync_dst/
Demo script output:
$ rsync -va /tmp/rsync_src/ /tmp/rsync_dst/
building file list ... done
dir/
dir/file.tmp
dir/file.txt
sent 214 bytes received 70 bytes 568.00 bytes/sec
total size is 8 speedup is 0.03
$ rsync --exclude=file.tmp --delete -van /tmp/rsync_src/ /tmp/rsync_dst/
building file list ... done
deleting dir/file.txt
deleting dir/ <--------------------------<<<<<<
sent 70 bytes received 20 bytes 180.00 bytes/sec
total size is 0 speedup is 0.00
$ rsync --exclude=file.tmp --delete -va /tmp/rsync_src/ /tmp/rsync_dst/
building file list ... done
deleting dir/file.txt
sent 70 bytes received 20 bytes 180.00 bytes/sec
total size is 0 speedup is 0.00
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the rsync
mailing list