![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| crontab; copy most recent *.mpg file from local machine to smb storage device | julezsht | Shell Programming and Scripting | 5 | 06-02-2009 05:24 PM |
| Copy file from local machine to server? | Sepia | UNIX for Dummies Questions & Answers | 2 | 05-12-2009 04:41 AM |
| check for a file on a remote machine | Sheema | Shell Programming and Scripting | 3 | 12-04-2008 04:43 AM |
| how to mount a file system of a remote machine to local file system | cy163 | UNIX for Dummies Questions & Answers | 2 | 01-31-2008 09:04 AM |
| [FTP]opying of file from remote to local machine | sonbag_pspl | SUN Solaris | 1 | 08-12-2004 04:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi All,
URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not supported when used inside the SCP command. To find LATEST file : Code:
`ls -1r | head -1` -UB Last edited by Yogesh Sawant; 07-06-2009 at 02:41 AM.. Reason: added code tags |
|
||||
|
Thanks Yogesh; but no luck on this as well.
In precise, I have : On SERVER1 dir1 contains: file1 file2 file3 --> latest one On SERVER2, I need to execute a script that fetchs file3 into dir2. Thanks. ---------- Post updated at 02:58 PM ---------- Previous update was at 11:53 AM ---------- Yippiee! After spending so much time doing R&D on this, I finally got an answer for myself! Hope this helps others as well. On SERVER2, save this as a script and execute: Code:
latest_file=`ssh IP_ADDR_OF_SERVER1 find /dir1 -type f -mtime -1 -name "file*"` echo Staring SCP of $latest_file from SERVER1 to SERVER2... /usr/bin/scp user@IP_ADDR_OF_SERVER1:$latest_file /dir2 echo SCP Completed. Enjoy. -UB |
![]() |
| Bookmarks |
| Tags |
| ftp, latest file, local, remote, scp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|