scp - rsync - create all missing parent directories? -
i'm looking rsync
-like program create missing parent directories on remote side.
for example, if have /top/a/b/c/d
on 1 server , /top/a
exists on remote server, want copy d
remote server , have b
, c
directories created well.
the command:
rsync /top/a/b/c/d remote:/top/a/b/c
won't work because /tmp/a/b
doesn't exist on remote server. , if did exist file d
copied path /top/a/b/c
.
this possible rsync
using --include
, --exclude
switches, involved, e.g.:
rsync -v -r dest:dir \ --include 'a/b' \ --include 'a/b/c' \ --include 'a/b/c/d' \ --include 'a/b/c/d/e' \ --exclude 'a/*' \ --exclude 'a/b/*' \ --exclude 'a/b/c/*' \ --exclude 'a/b/c/d/*'
will copy a/b/c/d/e
dest:dir/a/b/c/d/e
if intermediate directories have files. (note - includes must precede excludes.)
are there other options?
you may looking
rsync -ar
for example:
rsync -a --relative /top/a/b/c/d remote:/
see trick in other question.
Comments
Post a Comment