Timeline for Rsync filter: copying one pattern only
Current License: CC BY-SA 2.5
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 10, 2024 at 19:56 | comment | added | Alek | Good. Add -R option to recreate directory structure. | |
| Feb 4, 2015 at 16:28 | comment | added | Dan Pritts | Note that rsync's patterns used in the include and exclude filters also have a ** that does the same thing. You can escape *'s from other shells by putting them in quotation marks. | |
| Sep 29, 2010 at 17:34 | comment | added | Gilles 'SO- stop being evil' | Bash 4 has adopted the same feature. Oh, and you don't need rsync here, cp will do. On some systems, if there are a lot of files, it helps to do cd ~/Latex && cp -p **/*.pdf ~/Output to avoid a “command line too long” error. | |
| Sep 29, 2010 at 12:37 | comment | added | Seamus | I was worried that this solution wouldn't work if you had some pdfs in foo/ and some in foo/bar/ and you wanted them all moved that wouldn't work, but it does work. I like this answer, but I do actually want to preserve folder structure as well, so this doesn't work. But I do like the zsh ** trick, and I'm sure I'll use it in the future! | |
| Sep 16, 2010 at 19:10 | comment | added | Marcel Stimberg | Sorry, corrected the command I mistyped in a rush... I agree that the include command (in SamB's version) is better, though it is a bit more complicated and specific to rsync while the ** might become handy in other situations as well. | |
| Sep 16, 2010 at 19:07 | history | edited | Marcel Stimberg | CC BY-SA 2.5 | deleted 3 characters in body |
| Sep 16, 2010 at 18:58 | comment | added | Adam Byrtek | I guess you meant rsync -avn ~/LaTeX/**/*.pdf ~/Output, but the solution with --include is more scalable anyway. | |
| Sep 16, 2010 at 18:35 | comment | added | SamB | Wouldn't that copy all pdfs from somewhere within the current directory and everything from ~/LaTeX/ to ~/Output? | |
| Sep 16, 2010 at 17:25 | history | answered | Marcel Stimberg | CC BY-SA 2.5 |