bash - Rsync only particular files and directory that contain those files -


supposed have directory structure

src/ src/a/ src/a/1.ocf   src/a/1.pdf   src/a/1.txt src/b/ src/b/2.ocf src/b/2.pdf src/b/2.xls src/c/ src/c/3.doc src/c/3.ocf src/c/3.txt src/d/ 

then, want synchronize files extension *.txt. so, tried use command like:

#rsync -avvh --include="*/" --include="*.txt" --exclude="*" src/ dst/ sending incremental file list ./ a/ a/1.txt b/ c/ c/3.txt d/ 

unfortunately, command not synchronize *.txt file directory. don't want directory 'b' , 'd' synchronized because not contain file *.txt

is there simple way that?

the option you're looking -m prune empty directories:

rsync -avvhm --include="*/" --include="*.txt" --exclude="*" src/ dst/ 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -