LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-20-2019, 06:17 AM   #1
Pems
LQ Newbie
 
Registered: May 2019
Posts: 2

Rep: Reputation: Disabled
How to copy Latest file from Remote server directory to local server.


Hi Experts,

Looking for your helpful Inputs,

In Bash shell scripting, How to copy Latest file from Remote server directory to local server.

Yes, this command ls -rt FILE*|tail -1 is showing the desired file, but how to download this latest file to local directory from remote server.

Could you please suggest? Thanks in advance for your helpful tips.
 
Old 05-20-2019, 06:27 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,617

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Well, #1 do not post the same question twice in different areas of this site. IT violates a rule.
See https://www.linuxquestions.org/quest...er-4175654239/
Pick one, please, to host answers and close the other.

Update: never mind, that appears to have been done for you now.

#2 have you examined the man pages for scp, sftp, rsync, or any other tools for copying files between nodes?

Last edited by wpeckham; 05-20-2019 at 06:28 AM.
 
1 members found this post helpful.
Old 05-20-2019, 01:35 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Your question is very vague and tells us nothing about the relationship between the local and remote machines.

There are many tools and protocols available for file transfer, but no special built-in bash command for doing so.

I usually recommend sftp for most file transfers across the public network. Rsync over ssh might allow you to more easily specify the desired file by timestamp (i.e. most recent). Your choice might also be influenced by whether the transfer is over the internet or only across a LAN, the OS of the client and server machines, access controls... many variables to consider which no one here is aware of.

Please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy Latest file from Remote server directory to local server. Pems Linux - Newbie 1 05-20-2019 06:26 AM
[SOLVED] How to copy file from remote host to local host then delete from remote host legendmac Linux - Newbie 13 05-27-2015 03:47 PM
Get first file of directory then copy to other directory andd rename the file Faye Linux - Software 4 01-30-2011 09:16 AM
How to Copy files from local directory to a particular directory using alias dynamics Linux - Newbie 7 09-11-2009 04:19 PM
secure copy a latest data file from the remote host spkandy Linux - Networking 4 08-08-2009 02:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:41 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration