Hi All, I would to rsync data spread of many files from remote site. Each file may exist in total different location - the path for each file may be different. My question is: Can I do it one single rsync command, giving a file containing list of paths as parameter, or do I need to run rsync for each file. I did not find any option doing it in the man page. I tried to play with include/exclude, but it did not help.. How do I make rsync copy only specific paths? Thanks, Oren Mark Intel - Israel Engineering Computing Unix Server Platforms oren.mark@intel.com <mailto:oren.mark@intel.com> (+) 972-4-865-5987 iNET: 465-5987 -------------- next part -------------- HTML attachment scrubbed and removed
On Sun, 2006-01-15 at 09:15 +0200, Mark, Oren wrote:> Can I do it one single rsync command, giving a file containing list of > paths as parameter, or do I need to run rsync for each file.It looks like this is what you need. --files-from=FILE Using this option allows you to specify the exact list of files to transfer (as read from the specified FILE or "-" for standard input). It also tweaks the default behavior of rsync to make transferring just the specified files and directories easier: o The --relative (-R) option is implied, which preserves the path information that is specified for each item in the file (use --no-relative if you want to turn that off). o The --dirs (-d) option is implied, which will create directories specified in the list on the destination rather than noisily skipping them. o The --archive (-a) option?s behavior does not imply --recursive (-r), so specify it explicitly, if you want it. The file names that are read from the FILE are all relative to the source dir -- any leading slashes are removed and no ".." references are allowed to go higher than the source dir. For example, take this command: rsync -a --files-from=/tmp/foo /usr remote:/backup If /tmp/foo contains the string "bin" (or even "/bin"), the /usr/bin directory will be created as /backup/bin on the remote host. If it contains "bin/" (note the trailing slash), the immediate contents of the directory would also be sent (without needing to be explicitly mentioned in the file -- this began in version 2.6.4). In both cases, if the -r option was enabled, that dir?s entire hierarchy would also be transferred (keep in mind that -r needs to be specified explicitly with --files-from, since it is not implied by -a). Also note that the effect of the (enabled by default) --relative option is to duplicate only the path info that is read from the file -- it does not force the duplication of the source-spec path (/usr in this case). In addition, the --files-from file can be read from the remote host instead of the local host if you specify a "host:" in front of the file (the host must match one end of the transfer). As a short-cut, you can specify just a prefix of ":" to mean "use the remote end of the transfer". For example: rsync -a --files-from=:/path/file-list src:/ /tmp/copy This would copy all the files specified in the /path/file-list file that was located on the remote "src" host. Now, here's something I'm wondering: is there a way, given a list of unrelated (source, destination) pairs, to copy each source to the corresponding destination in a single run of rsync? -- Matt McCutchen, ``hashproduct'' hashproduct@verizon.net -- http://mysite.verizon.net/hashproduct/
Matt, Typically with Oracle databases, you will have datafiles residing on different mount points starting from the root such as: /p02/oradata/OSID/redo01.log /p03/oradata/OSID/redo02.log /p04/oradata/OSID/redo03.log /p01/oradata/OSID/system01.dbf /p04/oradata/OSID/undotbs01.dbf /p03/oradata/OSID/sysaux01.dbf /p03/oradata/OSID/users01.dbf /p03/oradata/OSID/example01.dbf /p03/oradata/OSID/data01.dbf /p02/oradata/OSID/index01.dbf /p01/oradata/OSID/control01.ctl /p02/oradata/OSID/control02.ctl /p03/oradata/OSID/control03.ctl /s01/oracle/product/10.2.0/dbs/initOSID.ora Requiring a command line something like this: rsync -a srchost:/ / --files-from=dbf-list and dbf-list would contain this: p02/oradata/OSID/redo01.log p03/oradata/OSID/redo02.log p04/oradata/OSID/redo03.log p01/oradata/OSID/system01.dbf p04/oradata/OSID/undotbs01.dbf p03/oradata/OSID/sysaux01.dbf p03/oradata/OSID/users01.dbf p03/oradata/OSID/example01.dbf p03/oradata/OSID/data01.dbf p02/oradata/OSID/index01.dbf p01/oradata/OSID/control01.ctl p02/oradata/OSID/control02.ctl p03/oradata/OSID/control03.ctl s01/oracle/product/10.2.0/dbs/initOSID.ora Do you see any problems with this? -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html ///**** lsk-> Linus in my case the destination server path name and source path name that includes SID is different so how you would build the rsync syntax using --files-from with this. rsync -zv --no-whole-file --stats /d01/app/sourSID/testfile2.dbf tarser:/t01/app/destSID/testfile2.dbf rsync -zv --no-whole-file --stats /d02/app/sourSID/testfile3.dbf tarser:/t02/app/destSID/testfile3.dbf rsync -zv --no-whole-file --stats /d03/app/sourSID/testfile4.dbf tarser:/t03/app/destSID/testfile4.dbf rsync -zv --no-whole-file --stats /d04/app/sourSID/testfile5.dbf tarser:/t04/app/destSID/testfile5.dbf Thanks, lsk. -- View this message in context: http://www.nabble.com/rsync-of-file-list-t920650.html#a3190257 Sent from the Samba - rsync forum at Nabble.com.