Repository navigation
ftp: add full modtime support - #5655
Merged
Merged
Conversation
ivandeex
force-pushed
the
pr-ftp-modtime
branch
4 times, most recently
from
October 5, 2021 17:52
2a67cb9 to
c421285
Compare
Member
Author
ivandeex
force-pushed
the
pr-ftp-modtime
branch
from
October 15, 2021 17:39
c421285 to
87d4902
Compare
This was referenced Oct 18, 2021
Closed
ivandeex
force-pushed
the
pr-ftp-modtime
branch
from
October 20, 2021 16:30
87d4902 to
ead353c
Compare
Member
Author
|
@ncw |
Member
Author
|
The beta branch https://github.com/rclone/rclone/commits/iva-ftp |
ivandeex
force-pushed
the
pr-ftp-modtime
branch
from
October 21, 2021 07:43
ead353c to
e3303ca
Compare
ivandeex
force-pushed
the
pr-ftp-modtime
branch
from
October 21, 2021 11:29
e3303ca to
9208555
Compare
ivandeex
force-pushed
the
pr-ftp-modtime
branch
from
October 21, 2021 11:32
9208555 to
8b97729
Compare
lafkpages
pushed a commit
to lafkpages/rclone
that referenced
this pull request
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intro
The original FTP RFC had very limited support for file time which is inadequate nowadays. The
LISTandNLSTcommands inherited their time format directly from the Unixlsutility which is optimized for humans not for strictness. Thus, they provided precise time to 1-sec resolution only for recently updated files but not for files older than one day. In fact, getting precise timestamps was generally impossible. TheMLSDextension partially improved situation for directory listings. Later such extensions asMDTMandMFMTadded protocol support for setting and getting time on individual files to 1sec precision. Today major FTP servers such as ProFTPd, PureFTPd, VsFTPd and Filezilla support the extensions making FTP really suitable for modern file storage.According to RFC 3659 the
MDTMcommand can be used to get file time with 1s precision andMFMTcan modify the time.VsFTPdisenfant terriblea notable exception. Its developers instead of supportingMFMTintroduced a strange, non-standard form ofMDTMto set file timestamps (see the code). The form is enabled by default (search formdtm_writein the man page to prove it). Thank gods, other FTP servers follow the standard.What is the purpose of this change?
Currently rclone FTP client can use
MLSDbut lacksMDTMandMFMT. This patch adds support for these commands when advertised by FTP server. The backend will use a combination of advertised commands and caching in the rclone Object structures to provide user with time to 1 second precision if possible.The new FTP option
writing_mdtmand CLI flag--ftp-writing-mdtmwill let users activate theVsFTPdquirk mentioned above. Note that by default the non-standard MDTM support is turned off for compatibility with existing applications. In future we may think about a way to detect VsFTPd on first connect and turn this on automatically. I decided to delay it for a future patch so it's out of scope for this PR.Unit test
The rclone test suite has a number of file timestamp tests but they are activated only on backends which report time support. The new FTP unit test just verifies that precise time is supported with major FTP servers: ProFTPd, PureFTPd, VsFTPd. The main test suite will check the rest.
Was the change discussed in an issue or in the forum before?
Fixes #2384
Fixes #5283
Related to https://forum.rclone.org/t/ftp-also-check-mod-time-against-upload-time-by-default/24536/10
Related to https://forum.rclone.org/t/rclone-does-not-update-mod-time-on-destination/15858
Depends on the upstream PR jlaffaye/ftp#233 which will introduce a few API calls:
GetTimeandSetTimeIsGetTimeSupported,IsSetTimeSupported,IsTimePreciseInListDialWithWritingMDTMto activate the VsFTPd quirkThe temporary DON'T MERGE commit will be removed after jlaffaye/ftp#233 get merged. It just allows to verify changes in advance...
Checklist