Solved

Issue with scp, ssh and files types

Posted on 2014-11-27
4
257 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
  • 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

756 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