I am trying to move very big file from one host to another host. Also the file names are too large so I have to use xargs. Also all the sub directories need to be copied also
I am using the below command in the source host current directory
find . -name "*" -type f -print0 | xargs -0 scp -r UserName@host:/path/to/destination
but it is throwing below error
scp: /path/to/destination: not a regular file
scp -r . userame@host:/path/to/destination
and avoid thefind
/xargs
bit? – Stephen Harris Aug 20 '16 at 13:09ksh: line 1: /usr/bin/scp: cannot execute [Argument list too long]
– Anirban Nag 'tintinmj' Aug 20 '16 at 13:37scp -r *
instead ofscp -r .
to get that argument list too long error? Apart fromscp
, you could usetar cf - . | ssh user@somewhere tar xf -
– ilkkachu Aug 20 '16 at 14:16find
finds all files (and directories, etc.) by default; tests like-type
,-mtime
,-name
,-user
and-group
then refine/restrict the search results by eliminating files (etc.) that don't satisfy the test. But the filename pattern*
means "all"; it doesn't restrict or eliminate anything. Therefore,-name "*"
has no effect in afind
command. – Scott - Слава Україні Aug 20 '16 at 20:42