Setting a files modified time in WebDrive for backup or synchronization software

Setting a files modified time in WebDrive for backup or synchronization software

Files that are uploaded to FTP, SFTP, and WebDAV servers typically get time stamped with the current date/time that the file was uploaded to the server and not what the original source file date/time was. On a typical hard drive or network drive when copying a file between folders the destination file will get stamped with the modified time and creation time that the source file had. This is important for file backup or synchronization software that relies on time stamps to determine if a file has been modified or not.   WebDrive supports the ability to set a files modified and creation time through standard file system support; however it relies on the server to support that capability. Some servers support setting the file modified time and some do not. 

Modern FTP servers typically support setting a files modified time, while older or Unix servers may not. SFTP servers do support setting the files modified time and therefore is generally a better solution if file synchronization is required. WebDAV protocol does not support setting a files modified time, but WebDrive supports a workaround described below. To enable the feature to set a files modified time on the server, make sure the setting "Set files modified time after upload to preserve date/time" on the site properties/file settings dialog is enabled.


FTP

Modern servers should support the MFMT command which allows clients to set a files modified time after uploading it to the server. Not all servers support this command; if your server does not, it will not be possible for WebDrive to stamp the files time on the server. 

Some older servers supported an undocumented feature of allowing the client to set the file modification time using the MDTM command. However, since MFMT command was published, this method is no longer preferred. Although it is supported in WebDrive and WebDrive will attempt to use this format if the server doesn't support MFMT, be advised that it's highly unlikely to work on your server. 

When WebDrive sets the modified time on the server, it uses UTC or GMT time by default; this is what the FTP specification calls for. Some FTP servers do not follow this convention. If yours does not, you can override this default behavior with an undocumented setting in WebDrive stored in the site profile in the registry, called "FtpMDTMUsesLocalTime". Set this to "1".   If your server is not in your time zone and requires an offset, see the FTP site properties tab to select a time zone so that a time offset will be applied when setting the files modified time on the server.


SFTP

All SFTP servers support the command to allow a client to set the files modified time after uploading a file, so you should not have any issues with backup or synchronization software. All file times in the protocol are in GMT/UTC and therefore not time zone specific.


WebDAV

WebDAV protocol does not have any command that would allow a DAV client to set a files modified time or creation time; however WebDrive has a method of pseudo support for setting a files modified time on the server. WebDrive accomplishes this with custom DAV properties. When a file system request comes into WebDrive to set a files modified time, it will set the following custom DAV properties on the server for the file in question.

Custom DAV Properties used by WebDrive:



  • "srt_modifiedtime"  -  set to the modified time requested by the file system

  • "srt_creationtime" - set to the creation time requested by the file system

  • "srt_proptimestamp" - this value is set to whatever value the server returns for the "getlastmodified" property for this file


Note: Not all WebDAV servers allow clients to set custom properties. Please check your server to see if it's enabled. For Apache, these custom properties when enabled are stored in a .DAV folder under the folder in which the files are uploaded to.

So when WebDrive uploads a local file called John.txt with a local date/time of "Dec 1, 1998 4:00PM" to the WebDAV server, it will set a property called "srt_modifiedtime" to "Dec 1, 1998 4:00 PM". When WebDrive requests the directory listing the server will respond with something that looks like this:

PROPFIND /mydir
<filename> John.txt
<getlastmodifiedtime> March 22, 1:37 PM     - controlled by server, not WebDrive
<srt_modifiedtime> Dec 1, 1998 4:00 PM
<srt_proptimestamp> March 22, 1:37 PM

The server assigns "getlastmodifiedtime" to the current date/time, in this example March 22, 1:37PM. When WebDrive parses this listing it sees the getlastmodifiedtime from the server, which is totally controlled by the server and can't be set by WebDrive. WebDrive also sees the "srt_modifiedtime" property and will use that time when displaying file times in explorer in the windows file system. So the user will see "Dec 1, 1998 4:00 PM" as the files modified time even though it's not the file's actual time on the server. This is useful because backup software will not see the intended time of the file. 

There is one catch, and that is the other property called "srt_proptimestamp". This is set by WebDrive to the value of "getlastmodifiedtime" at the time it sets the custom srt properties. This is done in case somebody else logs into the DAV server via RDP or SMB and changes the actual file date/time on the server file. If WebDrive notices a difference between the srt_proptimestamp and the "getlastmodified" property by more than a few seconds, WebDrive will NOT use the srt_modifiedtime stamp and  instead use the "getlastmodified" time.

Note: There is a setting in Webdrive called "use getlastmodified time for setting file time". This setting is old and really only supported by 1 or 2 DAV servers. Yours likely does not support it; please do not enable this setting.

    • Related Articles

    • 2019: How do I prevent WebDrive from setting the files modified time after Upload?

      To prevent WebDrive from setting the files modified time after an upload, select the site profile of interest and go to Site Properties --> Basic File Settings and enable "Set files modified time after upload to preserve date/time".  
    • Deleted Files

      Files Deleted in WebDrive Question What happens when I delete files while connected to a server using WebDrive? Answer When using WebDrive, files that are deleted are removed permanently, or moved to a supported Trash or Deleted Files folder. This ...
    • Can’t see Thumbnails or Preview of Files in Windows Explorer

      If you wish to see thumbnails or previews of files, edit the settings for your site in WebDrive. In the "Advanced" section, turn on the setting for "Enable thumbnails and file preview".
    • WebDAV Timestamps

      WebDAV Timestamp WebDAV servers don't typically allow clients to set a files modified time on the server so WebDrive uses a work around to provide a way to store a files modified time using custom DAV properties. This is how WebDrive will determine ...
    • Cache Setting Details

      Cache Setting Details Question What do each of the Cache Settings mean? What effects come from changing each setting? Answer Cache Files/Folder listings: Choose whether to store files and directory listings in cache or have them always be downloaded ...