On Thu, 2007-12-06 at 19:23 -0200, Rivanor P. Soares
wrote:> I'm running rsync (2.6.2)
That's pretty old. You might want to upgrade to the latest stable
version, 2.6.9.
> I want to sync all .fle files from dir1 to the dir2 and also remove
> files from the destination which were removed from the sending side,
> using no recursion. Already tried this:
>
> rsync -vbu --recursive --delete --backup-dir=/bkp --stats
> --include "/dir1/" --include "/dir1/*.fle" --exclude
"*" /dir1/ /dir2
This is the right idea, but:
1. Rsync compares your anchored include patterns to file-list paths,
which begin at the last slash in the source path and thus don't contain
the /dir1 . Remove this prefix from the include patterns if you expect
them to match.
2. The source directory itself is included regardless of exclude rules,
so you don't need the first include rule.
Here is the revised command:
rsync -vbu --recursive --delete --backup-dir=/bkp --stats --include
"/*.fle" --exclude "*" /dir1/ /dir2
Note that the exclude rule stops rsync from deleting any non-"*.fle"
files from the destination. If you want extraneous non-"*.fle" files
deleted, pass --delete-excluded .
Matt