madmat
November 2, 2009, 8:59am
1
Hi
I have a problem with scp command :
I try to copy a list of files from source to destination, it works fine but if there is a directory not existing on destination, it doesn't automatic create.
Syntax :
scp -rp /<PATH>/<NEW_DIR>/<FILE> <USER_DEST>@<HOST_DEST>:<PATH>/<NEW_DIR>/<FILE>
scp: <PATH>/<NEW_DIR>/<FILE>: No such file or directory
Any idea ?
TY
Mat
It works for me. What is the OS/platform?
Or may be you need something like this?
scp -rp /<PATH>/<NEW_DIR>/<FILE> <USER_DEST>@<HOST_DEST>:<PATH>/
madmat
November 2, 2009, 9:42am
3
radoulov:
It works for me. What is the OS/platform?
Or may be you need something like this?
scp -rp /<PATH>/<NEW_DIR>/<FILE> <USER_DEST>@<HOST_DEST>:<PATH>/
OS/platform is Linux RHEL4.
With your code, the file is directly copied on <PATH> and <NEW_DIR> is not created.
Another way ?
scp -rp /<PATH>/<NEW_DIR> <USER_DEST>@<HOST_DEST>:<PATH>/
The above will create <NEW_DIR> and copy its content.
If that's not what you want, I suppose you could
run ssh mkdir -p ... before running the scp command ...
madmat
November 2, 2009, 10:37am
5
Thank you, but I'd like to automatic create the correct path on destination but maybe it's not possible...
With tar and ssh you can do something like this:
tar cvf - ./new_dir/file | ssh user@host 'tar pxvf -'