John's Blog: File Modification Dates

Jan 12, 2012

One question that comes up from time to time is why a file's "last modified" date gets changed when it is uploaded or downloaded. The answer is simple, though, if you think about what is really going on when a file is transferred to or from your server.

Consider a file upload via Web browser, for example. When a browser uploads a file, it isn't actually sending a physical thing. Rather, the browser makes a connection to the server and says "I'm going to send you a file called, 'foo', and here's the data." Rumpus then creates a file on the local system called "foo" and saves the file data sent by the client into that file. What you actually have on the server is a brand new file that contains a copy of the contents of the original, and so the modification date/time of the new file will be set to the time the upload completes.

In the case of a basic file transfer like the one I just described, Rumpus has no idea what the original file's last modified time is, so it's impossible to preserve it. Via basic HTTP (Web browser transfers), there is no mechanism to send the last modified date of a file, so this information will always be lost in Web transfers. For FTP transfers, however, there are ways to preserve this information.

The most common method is for FTP clients to use FTP extension commands that allow the client to manually alter the modification date/time of a file. In this case, the client uploads a file, and then issues a special "site" command to tell the server what the file modification date should be. Rumpus supports these FTP extensions, so if an FTP client supports this feature, the modification date will be preserved. There are cases where FTP clients support the extension commands, but make a mess of things and end up doing more harm than good. If the "site" commands are causing you trouble, they can be disabled in Rumpus. Contact me at "support@maxum.com" for help, if you need it.

The other option is to use MacBinary transfers. MacBinary is a standard format for transferring files over the Internet that allows the transfer to preserve the file's "Finder Info", including the file modification date. Rumpus supports MacBinary, too, so if you use a MacBinary compatible FTP client, and send files using MacBinary encoding, the file modification date will be preserved, both through file uploads and downloads. MacBinary is an older standard, developed in the days of Mac OS 6/7/8/9, and isn't used by very many clients any more, but those FTP clients that have been around for a while (Fetch, for example) will still use MacBinary transfers when possible.

© Copyright 2017, Maxum Development Corp.