-   Linux - Networking (
-   -   secure copy a latest data file from the remote host (

spkandy 08-07-2009 03:23 AM

secure copy a latest data file from the remote host
Hi All,
Greetings for the day..

I just want to secure copy a latest data file from the remote host.
Is there any option available in 'SCP'?
I am using ssh key-authentication, so SCP/SSH is the only option.
Please help me..


Simon Bridge 08-07-2009 03:30 AM

Here is a highly readable ssh tutorial which includes how to use scp to copy files over a network.

jschiwal 08-07-2009 04:40 AM

The server on the remote host determines whether your public key is used, or if you use a username/password. Do you have a user account on the remote ssh server? Also have a look at sftp. It will allow you to browse to the file, if you don't know its exact name or location.

spkandy 08-08-2009 02:24 AM

Hi jschiwal,
I am Ok with SSH Connectivity..
Here my concern is How can I transport the latest file of particular pattern created in the remote file system.


Simon Bridge 08-08-2009 02:46 AM

scp report.odt

Lets see if I get this, your problem is that you want to transfer across, say, all the files *.odt and scp*.odt *.odt doesn't help?

what about:"*.odt"

However, maybe your issue is that scp asks for a password each time it fetches a file from the pattern?

[reread]your post indicates that it is only one file you want to transfer. Is it that you want to download the file with the most recent timestamp from a collection? Or perhaps there are a list of files:


and you want the one with the most recent <date>?

How the pattern is managed will provide the specific reply.

You could just fetch "report-*.odt", but maybe there have been several updates? You also don't want to download all the reports you already have all over again.

In general, this will involve writing a script.

scp -p remotehost:"report-*.odt"

once the file has downloaded, chmod u-w so that the next invocation of scp won't over-write and re-fetch the same file. The "-p" option will preserve the access times so you can see what the latest version is.

All times are GMT -5. The time now is 05:44 PM.