LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-22-2005, 08:24 AM   #1
tpreitano
LQ Newbie
 
Registered: Aug 2005
Posts: 7

Rep: Reputation: 0
scp/ssh tail(multiple file) remote copy


I currently have a crontab running a script like so..............

/usr/bin/scp username@x.x.x.x:/data/noaa/bigross/'*.Z' /data/products/hrpt/bigross/
/usr/bin/scp username@x.x.x.x:/data/noaa/ross/'*.Z' /data/products/hrpt/ross/
/usr/bin/scp username@x.x.x.x:/data/noaa/mcmu/'*.Z' /data/products/hrpt/mcmu/
/usr/bin/scp username@x.x.x.x:/data/noaa/spole/'*.Z' /data/products/hrpt/southpole/

I want to incorporate something like ls -tr | tail -3, so I can get the last three files to date, instead of all. I don't mind changing the script to use ssh login first. Please advise. Thanks Ahead.

TPR
 
Old 08-22-2005, 03:17 PM   #2
zedmelon
Member
 
Registered: Jun 2004
Location: colorado, USA
Distribution: slack, oBSD
Posts: 119

Rep: Reputation: 22
a loop?

Not sure I grasp what you want to do, but a loop should work. I can't think of a way to lump all the filenames into one command, so this would require either RSA key login, or a password entry each time.

for FILE in `ls -tr | tail -3`
do
scp user@host /path/$FILE .
done

Or you could look into using rsync, which copies only updated files and can use ssh as the connect protocol.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP: Copy file from remote linux server onto a windows machine? Tony Empire Linux - Newbie 19 06-04-2013 06:13 AM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 01:23 PM
SCP Copy File SSH petenyce Linux - Wireless Networking 2 10-05-2005 04:11 PM
copy from remote with ssh mehlkelm Linux - Networking 4 09-02-2004 09:11 AM
scp :copy file from one remote comp to another aniketh Linux - Networking 4 06-16-2004 03:31 AM


All times are GMT -5. The time now is 06:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration