--delete and --files-from

View: New views
4 Messages — Rating Filter:   Alert me  

--delete and --files-from

by Aaron Davies-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to maintain mirror of a sliding window of the last N  
subdirectories of a particular directory. My first attempt was to use  
ls -t|head to generate a list of dirs to pass to --files-from (with --
recursive). It's working nicely to add the new files to the mirror  
each day, but --delete isn't removing the old files (which are now  
which are now outside the window and not in the --files-from file).

My guess is that the subdirectories of the target directory not  
mentioned in the --files-from file are not considered part of the sync  
and are thus not considered for deletion. (Whereas if there were files  
in directory inside the window that were present only on the remote  
end, they *would* be deleted.) Am I correct in this analysis? How  
would you suggest I fix this?

Sent from my iPhone
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: --delete and --files-from

by Matt McCutchen-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-06-25 at 16:26 -0400, Aaron Davies wrote:

> I want to maintain mirror of a sliding window of the last N  
> subdirectories of a particular directory. My first attempt was to use  
> ls -t|head to generate a list of dirs to pass to --files-from (with --
> recursive). It's working nicely to add the new files to the mirror  
> each day, but --delete isn't removing the old files (which are now  
> which are now outside the window and not in the --files-from file).
>
> My guess is that the subdirectories of the target directory not  
> mentioned in the --files-from file are not considered part of the sync  
> and are thus not considered for deletion. (Whereas if there were files  
> in directory inside the window that were present only on the remote  
> end, they *would* be deleted.)
Correct.

> How would you suggest I fix this?

There's an enhancement request for a way to delete unlisted files with
--files-from:

https://bugzilla.samba.org/show_bug.cgi?id=3465

Without the enhancement, the easiest thing to do is to use filters
instead of --files-from.  The files-to-excludes script that comes in
support/ of the rsync source tree will help you make the conversion
automatically:

http://rsync.samba.org/ftp/unpacked/rsync/support/files-to-excludes

Matt


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

signature.asc (204 bytes) Download Attachment

Re: --delete and --files-from

by Wayne Davison-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jun 25, 2008 at 04:26:08PM -0400, Aaron Davies wrote:
> My guess is that the subdirectories of the target directory not
> mentioned in the --files-from file are not considered part of the
> sync and are thus not considered for deletion.

No, not if you've explicitly specified -r (since -a doesn't imply -r
with --files-from).  Subdirectories of specified directories are
synchronized, just like normal.

..wayne..
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: --delete and --files-from

by Matt McCutchen-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2008-06-26 at 07:41 -0700, Wayne Davison wrote:
> On Wed, Jun 25, 2008 at 04:26:08PM -0400, Aaron Davies wrote:
> > My guess is that the subdirectories of the target directory not
> > mentioned in the --files-from file are not considered part of the
> > sync and are thus not considered for deletion.
>
> No, not if you've explicitly specified -r (since -a doesn't imply -r
> with --files-from).  Subdirectories of specified directories are
> synchronized, just like normal.

Wayne, I think you are misunderstanding Aaron's message.  As I read it,
the "target directory" is the destination argument, the "subdirectories"
are the files-from entries, and the problem is that these
"subdirectories" themselves are not deleted when they are no longer
listed in the --files-from file (which is the topic of bug 3465).

Matt


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

signature.asc (204 bytes) Download Attachment
LightInTheBox - Buy quality products at wholesale price