Copying many sources to different places inside a destination

Matt McCutchen hashproduct at verizon.net
Mon Feb 27 23:33:44 GMT 2006


Rsync people,

I am preparing to overhaul my Web site's build system, and I am looking
for a convenient way to collect files and directories from various
places on my computer and put them at various locations inside a
destination directory to be posted to my Web site.  So far, my script
has been running rsync once for each source, but this is too slow.  Is
there a way to get rsync to collect many sources in one pass to
destination locations more flexible than those that --relative will
allow me?

For example, suppose I want to copy sources something like this:
	~/main-web-content/     -> ~/www/
	~/logicdes/             -> ~/www/logicdes/
	~/bigint/svn-repo/      -> ~/www/bigint-svn/
        ~/vectors/vectors.tex   -> ~/www/math/vectors.tex
        ~/mirror/mirror-latest/ -> ~/www/mirror/bin/
and so forth.  All the sources go different places inside ~/www and
together make up everything I want in ~/www, so I would like the ability
to delete extraneous files.  But the parts of the destination paths
following ~/www are not always suffixes of the source paths, so
--relative with dot-dirs is not good enough.

If, as I suspect, support for such rearrangement of sources would
require a new syntax, let me propose the following.  When --relative is
repeated, the sending rsync takes source arguments (or --files-from
lines) in pairs: the first gives the real location of the source and the
second gives the prefix to put on the source filenames in the file list.
Then these two calls would be equivalent:
	rsync -r foo/src bar/othersrc dest/
	rsync -r -RR foo/src src bar/othersrc othersrc dest/
as would these:
	rsync -r -R foo/src bar/./othersrc dest/
	rsync -r -RR foo/src foo/src bar/othersrc othersrc dest/
-- 
Matt McCutchen
hashproduct at verizon.net
http://hashproduct.metaesthetics.net/



More information about the rsync mailing list