linux - Select SCP Copy -


i've seen example used rsync , ssh this, in specific case not working - gave me error protocol versions

i'd copy on files of type .sh, .jar, .war directory structure on remote host 2 hop (ssh proxy) ssh away.

i'm not sure of best way this. scp or sort of bash script?

what know:

find . | grep "\.sh" 

will give me nice list of files , can use xargs them.

i guess options create tar.gz file , scp over, or perhaps write little bash script individual scp-ing?

i came terrible way perl slow

my $find = `find .`;  $remote = "user\@machine:";  $remoteprefix = "/devel/test";   @files = split('\n', $find);  foreach (@files) {      if (/(.*\/)([^\/]*\.sh)$/ or         /(.*\/)([^\/]*\.jar)$/ or         /(.*\/)([^\/]*\.war)$/         ) {          $fullpath = $_;         $directory = $1;         $file = $2;       # print "$fullpath => $directory   ||     $file\n";      $cmd1 = qq(ssh user\@machine mkdir -p $remoteprefix$directory);     $cmd2 = qq(scp $_ $remote$remoteprefix$_);       `$cmd1`;     `$cmd2`;     } } 

assuming filenames don't contain newlines, can cpio(1):

find . -type f \( -name '*.sh' -o -name '*.[jw]ar' \) -print | \     cpio -oa | \     ssh "${user}@${machine}" "cd ${remoteprefix}; cpio -idm" 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -