forked from TrueCloudLab/rclone
sftp: add 'set_modtime' hidden configuration option
This commit is contained in:
parent
5e83dce1f6
commit
57f1bb7bb2
2 changed files with 12 additions and 5 deletions
|
@ -147,6 +147,11 @@ Modified times are stored on the server to 1 second precision.
|
||||||
|
|
||||||
Modified times are used in syncing and are fully supported.
|
Modified times are used in syncing and are fully supported.
|
||||||
|
|
||||||
|
Some SFTP servers disable setting/modifying the file modification time after
|
||||||
|
upload (for example, certain configurations of ProFTPd with mod_sftp). If you
|
||||||
|
are using one of these servers, you can set the option `set_modtime = false` in
|
||||||
|
your RClone backend configuration to disable this behaviour.
|
||||||
|
|
||||||
### Limitations ###
|
### Limitations ###
|
||||||
|
|
||||||
SFTP supports checksums if the same login has shell access and `md5sum`
|
SFTP supports checksums if the same login has shell access and `md5sum`
|
||||||
|
|
12
sftp/sftp.go
12
sftp/sftp.go
|
@ -812,14 +812,16 @@ func (o *Object) SetModTime(modTime time.Time) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "SetModTime")
|
return errors.Wrap(err, "SetModTime")
|
||||||
}
|
}
|
||||||
err = c.sftpClient.Chtimes(o.path(), modTime, modTime)
|
if fs.ConfigFileGetBool(o.fs.name, "set_modtime", true) {
|
||||||
o.fs.putSftpConnection(&c, err)
|
err = c.sftpClient.Chtimes(o.path(), modTime, modTime)
|
||||||
if err != nil {
|
o.fs.putSftpConnection(&c, err)
|
||||||
return errors.Wrap(err, "SetModTime failed")
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "SetModTime failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = o.stat()
|
err = o.stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "SetModTime failed")
|
return errors.Wrap(err, "SetModTime stat failed")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue