Issue with scp, ssh and files types

Posted on 2014-11-27
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:

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:

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
Question by:carlino70
  • 2
LVL 68

Accepted Solution

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".

Author Comment

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

LVL 62

Expert Comment

ID: 40469691
basename command shows just file name minus path

Author Closing Comment

ID: 40470463
It's work!
Thankyou again

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

813 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