[Bug 801] Improve usability of scp by adding a "make path" option

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri Feb 27 03:18:05 EST 2004


------- Additional Comments From jmknoble at pobox.com  2004-02-27 03:18 -------
> I would like to see an option added to scp that would cause
> the creation of any non-existent directories leading up to the
> target file

Such functionality already exists, using ssh:

    cat file.dat |ssh remote \
    'mkdir -p some/new/dir && cd some/new/dir && cat >file.dat'

This also works in reverse:

    (cd && mkdir -p some/new/dir && cd some/new/dir && \
    ssh remote 'cat file.dat' >file.dat)

This functionality can easily be automated via a script at either
end of the conversation.

Alternatively, if all you want to do is replicate directory
structures, use 'tar':

    tar cf - path/to/file.dat |ssh remote 'tar xvpf -'

or 'pax':

    pax -w path/to/file.dat |ssh remote 'pax -rvp e'

Good luck.

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the openssh-bugs mailing list