[paramiko] copying only recent files from one machine to another.
James Bardin
jbardin at bu.edu
Thu Mar 22 06:48:53 PDT 2007
If you're not looking to create stateful transfers, you could just
compare the mtime of the local and remote files.
An sftp instance has stat(), and lstat() methods. These return an
SFTPAttributes object with properties that can be compared with
os.stat() and os.lstat().
-jim
Manpreet Singh Khurana wrote:
> First of all let me tell you that get and put function do not throw
> exceptions. If you read the Paramiko API document it states that the
> exceptions will be "passed through".
> I dont think there is a API in python which can do stateful file
> fetching, though what you can do is that you tokenize your file
>
> Tokanize your file with the field separator bu using "split" API and
> then store the last timestamp in a external file . In the next fetch
> compare with the stored TS with the new TS and if new TS is less than
> the stored value skip it else fetch it and update the file with this
> new TS.
>
> Manpreet
>
> On 3/22/07, kadarla kiran kumar <kadarlakiran at yahoo.com> wrote:
>
>> Hi Everybody,
>>
>> Iam trying to copy files from one machine to another over SFTP connection.
>> For that Iam using sftp.get & sftp.put methods.
>>
>> Now, I have to copy only recently created/modified files,i.e, based on
>> timestamps from remote machine to my machine. Is there any standard
>> implementation for that in python/paramiko ? If not , can anyone suggest me
>> the efficient method to implement the same.
>>
>> Thanks in Advance,
>> Kiran Kumar
>>
>> ________________________________
>>
More information about the paramiko
mailing list