Solved

Issue with scp, ssh and files types

Posted on 2014-11-27
4
252 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 61

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now