Solved

Issue with scp, ssh and files types

Posted on 2014-11-27
4
258 Views
Last Modified: 2014-11-28
Hi Experts, I'm doing:
ssh user@remote_IP find remote_path -name Transfer_data. * -maxdepth 1 perm perm -444 / 222! -perm / 111 -type f> TEMP_GIS / lista.lst

Open in new window

then on "TEMP_GIS / lista.lst" I have:
remote_path/Transfer_data.20141119172332
/remote_path/Transfer_data.20141119172032
/remote_path/Transfer_data.20141127120302
/remote_path/Transfer_data.20141127120232
/remote_path/Transfer_data.20141126165232
/remote_path/Transfer_data.20141126165203
/remote_path/Transfer_data.20141127115632
/remote_path/Transfer_data.20141127112703

Open in new window

this is almost correct, but how do I copy these files using scp -p command to another local directory, called INPUTS_GIS?

And I need in lista.lst:
Transfer_data.20141119172032
Transfer_data.20141127120302
Transfer_data.20141127120232
Transfer_data.20141126165232
Transfer_data.20141126165203
Transfer_data.20141127115632

Open in new window

Sorry if the question is very basic, but I need to resolve it as quickly as possible.
Thank you very much
Regards
0
Comment
Question by:carlino70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 40469513
To make "lista.lst" contain just the filenames you can do:

ssh user@remote_IP find remote_path ... ... ... -type f |xargs -I{} basename {} > TEMP_GIS/lista.lst

Open in new window


"... ..." stands for the rest of the find command (i didn't want to type all that).

Please explain what you mean with "copy to another local directory"!

Do you mean "copy the files listed in "lista.lst" from the remote server to the local machine"?

If so, you could do:

xargs -I{} scp user@remote_IP:/source/path/{}   /INPUTS_GIS/ < TEMP_GIS/lista.lst

Open in new window


"/source/path/ is the path on "remote_IP", probably "/remote_path".
0
 

Author Comment

by:carlino70
ID: 40469589
Excellent, you understood good!
I' ll try this.

Tkankyou
0
 
LVL 62

Expert Comment

by:gheist
ID: 40469691
basename command shows just file name minus path
0
 

Author Closing Comment

by:carlino70
ID: 40470463
It's work!
Thankyou again
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question