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
Solved

Issue with scp, ssh and files types

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
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…

829 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