[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about sftp and timestamp


Hi Claudio,

you can use sftp_setstat() or sftp_utimes() to set the file timestamps.
I recommend the first one as it allows you to decide which timestamps to
set. The time is passed as seconds and nanoseconds since 1970. The 64
bit fields in the sftp_attributes structure are not really used. Just
set mtime, mtime_nseconds and so on.

See: http://api.libssh.org/master/group__libssh__sftp.html

Regards
Tilo

Am 13.12.2016 um 13:36 schrieb Fischer, Claudio:
> hi all,
> 
> i have a question about copying a file with libssh sftp.
> 
> If i copy a file with sftp_write(), the copied file gets the
> timestamp of the actual copy date and time of the system.
> 
> Is there a option to keep the same timestamp for
> a copied file like in the original file?
> 
> Like the cp command does with the option
> "-p same as --preserve=mode,ownership,timestamps"
> 
> 
> regards,
> Claudio


References:
Question about sftp and timestamp"Fischer, Claudio" <Claudio.Fischer@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org