Sync files not folders non recursively

Matt McCutchen matt at
Wed Mar 4 18:13:01 GMT 2009

On Wed, 2009-03-04 at 15:13 +0100, Ehlers, Kolja wrote:
> What I am trying to do is to simply sync files with a special
> suffix to a destination folder. So I dont want to transfer recursively but I
> want to delete files from the destination which are not in the source
> anymore.
> Closest I have gotten is using this command:
> /usr/bin/rsync -dnolptgvze --delete --delete-excluded --include='*.htm' --in
> clude='*.html' --exclude='*' /SOURCE/ /DESTINATION/
> BUT this deletes Files from folder /DESTINATION/A which are not present in
> the Source. I dont want this to happen.

--delete-excluded is doing that.  Remove that option.

> Also it syncs folders to DESTINATION
> but I only want to sync files not folders.

That shouldn't be happening given your include/exclude rules.  Please
pass -i and post the itemize output so I can see what is happening.


More information about the rsync mailing list