Copying one directory tree to another but exclude all top-level files
Paul Slootman
paul+rsync at wurtel.net
Fri Jan 30 15:19:41 UTC 2026
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
More information about the rsync
mailing list