i want rsync to include all the *.dat files(and the *.dat files in the subdirectory), and exclude all other files. how can i write the filter rules? i have read the man rsync, but i still got no idea to do it. for example, the result of find -printf "%y %p\n" is below: d . d ./1 d ./1/a f ./1/a/a.c f ./1/a/a.d f ./1/a/a.dat f ./1/a/b f ./1/a.c f ./1/a.d f ./1/a.dat f ./1/b d ./2 how can i only rsync all the *.dat files from 1 to 2? is there any way to do this without use find command? -- contact me: MSN: walkerxk at gmail.com,walkerxk at hotmail.com GTALK: walkerxk at gmail.com QQ:25329680
On Wed, 2009-11-25 at 21:20 +0800, ?? wrote:> i want rsync to include all the *.dat files(and the *.dat files in the > subdirectory), and exclude all other files. how can i write the filter > rules? i have read the man rsync, but i still got no idea to do it. > for example, the result of find -printf "%y %p\n" is below: > d . > d ./1 > d ./1/a > f ./1/a/a.c > f ./1/a/a.d > f ./1/a/a.dat > f ./1/a/b > f ./1/a.c > f ./1/a.d > f ./1/a.dat > f ./1/b > d ./2 > how can i only rsync all the *.dat files from 1 to 2? is there any way > to do this without use find command?>From the "INCLUDE/EXCLUDE PATTERN RULES" section of the man page:Here are some examples of exclude/include matching: The combination of ?+ */?, ?+ *.c?, and ?- *? would include all directories and C source files but nothing else (see also the --prune-empty-dirs option) -- Matt
thank you very much, i think i have made a mistake on understanding the manual.now i understand. On Thu, Nov 26, 2009 at 03:20, Matt McCutchen <matt at mattmccutchen.net> wrote:> On Wed, 2009-11-25 at 21:20 +0800, ?? wrote: >> i want rsync to include all the *.dat files(and the *.dat files in the >> subdirectory), and exclude all other files. how can i write the filter >> rules? i have read the man rsync, but i still got no idea to do it. >> for example, the result of find -printf "%y %p\n" is below: >> d . >> d ./1 >> d ./1/a >> f ./1/a/a.c >> f ./1/a/a.d >> f ./1/a/a.dat >> f ./1/a/b >> f ./1/a.c >> f ./1/a.d >> f ./1/a.dat >> f ./1/b >> d ./2 >> how can i only rsync all the *.dat files from 1 to 2? is there any way >> to do this without use find command? > > >From the "INCLUDE/EXCLUDE PATTERN RULES" section of the man page: > > ? ? ? ?Here are some examples of exclude/include matching: > > ? ? ? ?The combination of ?+ */?, ?+ *.c?, and ?- *? would include all > ? ? ? ?directories and C source files but nothing else (see also the > ? ? ? ?--prune-empty-dirs option) > > -- > Matt > >-- contact me: MSN: walkerxk at gmail.com,walkerxk at hotmail.com GTALK: walkerxk at gmail.com QQ:25329680