Re: Copying one directory tree to another but exclude all top-level files

2026-01-30 Thread Kevin Korb via rsync

That looks right to me.

If you want the files within the dirs you ca:

--include='/*/***' --exclude='/*'

On 2026-01-30 10:19, Paul Slootman via rsync wrote:

On Fri 30 Jan 2026, Brian J. Murrell via rsync wrote:

On Fri, 2026-01-30 at 08:56 -0500, Kevin Korb via rsync wrote:

It sounds like you want: --include='/*' --exclude='/*/'

No.  That doesn't work either.

I think Kevin got it the wrong way round.
You first need to include all directories on the root level,
then exclude all the rest on the root level:

--include='/*/' --exclude='/*'


Paul



--
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: Copying one directory tree to another but exclude all top-level files

2026-01-30 Thread Paul Slootman via rsync
On Fri 30 Jan 2026, Brian J. Murrell via rsync wrote:
> On Fri, 2026-01-30 at 08:56 -0500, Kevin Korb via rsync wrote:
> > It sounds like you want: --include='/*' --exclude='/*/'
> 
> No.  That doesn't work either.

I think Kevin got it the wrong way round.
You first need to include all directories on the root level,
then exclude all the rest on the root level:

--include='/*/' --exclude='/*'


Paul

-- 
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: Copying one directory tree to another but exclude all top-level files

2026-01-30 Thread Brian J. Murrell via rsync
On Fri, 2026-01-30 at 08:56 -0500, Kevin Korb via rsync wrote:
> It sounds like you want: --include='/*' --exclude='/*/'

No.  That doesn't work either.

> but I am having 
> a bit of trouble understanding your goal.

Unfortunately I'm not sure how to make it any more clear than I did
already.

I want to copy a directory tree to another location but not copy any
**files** at the top of the tree.

Using `--exclude-from <(find . -maxdepth 1 -type f -printf "%P\n")`
instead of `--exclude *` achieves the goal (so maybe that is more
illustrative of my goal), but I was hoping to achieve the goal without
having to involve an external process.  I.e. with just --include/--
exclude switches.

> You are right though that an 
> exclude of * means exclude everything.

Indeed.

> BTW, a second -v enables include/exclude debugging.

Thanks.

Cheers,
b.

-- 
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: Copying one directory tree to another but exclude all top-level files

2026-01-30 Thread Kevin Korb via rsync
It sounds like you want: --include='/*' --exclude='/*/' but I am having 
a bit of trouble understanding your goal.  You are right though that an 
exclude of * means exclude everything.


BTW, a second -v enables include/exclude debugging.

On 2026-01-30 08:23, Brian J. Murrell via rsync wrote:

Hi.

I want to do this:

# rsync -aSPAHX --exclude \* --link-dest=/.snapshots/daily.10/ ../daily.10/ .

so that any *files* in the /.snapshots/daily.10/ directory (but not any
directories in /.snapshots/daily.10/ and directories and files below
that) are excluded?

Using the above syntax, nothing gets copied I suppose because * matches
all of the top-level directories in /.snapshots/daily.10/ also.

Cheers,
b.



--
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