find . -maxdepth 2 -mindepth 1 -type d | grep -e '\/.*\/.*' | cut -d\. -f2 | cut -d\/ -f2- | tee .rsyncignore

This will ignore everything at the depth of two. Run with

rsync --exclude-from=.rsyncignore -Pave 'ssh -p $remote_port' $remote_host:$remote_base_path .

BTW, no need for -mindepth 1 in `find` clause, oops.

Show thread
Follow

Less wrong:

find . -maxdepth 2 | grep -e '\/.*\/.*' | cut -d\. -f2- | cut -d\/ -f2-

How I do it now:

find . -type f | grep -e '\/.*\/.*' | cut -d\. -f2- | cut -d\/ -f2- | tee -a .rsyncignore

Show thread
Sign in to participate in the conversation
Doma Social

Mastodon server of https://doma.dev.