Preserving dates and times of directories

Discuss new features and functions
Posts: 3
Joined: 30 Oct 2021

ocornut

I've been using FFS for years for personal backups, but nowadays I need to backup things where it is important for me to preserve folder dates, and I'm extremely surprised FFS doesn't carry that over.
I wouldn't mind the sync being slower if FFS had an option to carry them over. Surely it must be possible?
User avatar
Posts: 3633
Joined: 11 Jun 2019

xCSxXenon

If I remember correctly, it's the API that Windows is providing that doesn't include this feature. Zenju will have to chime in to confirm. I believe that the only way to save timestamps for directories is to implement robocopy into FFS that can run after a sync to preserve timestamps. Sync utilities that have this feature seem to be few and far between, but I did read that Total Commander can do it. I have no experience with this software, but I wonder how it is working to fulfill that request.
Posts: 3
Joined: 10 Jul 2022

Waves

ocornut,

Mine was the reply right before yours, and I agree.
For now the best workaround I know (found via this forum) is using the "Run a command" feature in Synchronization Settings to execute a Robocopy command at the end of the job. For ex:
robocopy "F:\Projects" "W:\F Backup\Projects" /e /timfix /xf *
This seems to carry over the folder dates.
Posts: 3
Joined: 30 Oct 2021

ocornut

Thank you. Been toying with robocopy as well, "robocopy SRC\ DST\ /MIR /DCOPY:T" seemed to do the job for me but then at this point I'm not using FFS anymore.

FFS is a wonderful, full-featured software, and technically speaking could support this given the time/effort. I do believe Robocopy does it as a "second" pass as during the copy the folders have current timestamp, and then I guess at the end it goes through folders and copy that info over.
User avatar
Site Admin
Posts: 7058
Joined: 9 Dec 2007

Zenju

If I remember correctly, it's the API that Windows is providing that doesn't include this feature. Zenju will have to chime in to confirm. xCSxXenon, 07 Aug 2022, 19:56
The API to set folder modtime is working fine. The problem is, folder modtime, as it is designed, is not very useful: Each time a file or subfolder is created or deleted the parent folder's modtime changes, but only then.
E.g. if a file is overwritten directly, the folder modtime does not change.
If a file is updated by first creating a temp file, then renaming to target, modtime does change.
If a folder including subfolders is copied with Windows Explorer, all the folder modtime are set to "now".

If the semantics were "folder modtime = last time an item was created/deleted/modified", it would be more useful. So it's a similar issue like with creation time, which is not the time a file was created (but the time the inode was).

On top of that, supporting folder modtime adds extra complexity to a sync operation. modtime needs to be set after all the files have been copied and folders were created, so would need an extra pass at the end.

Conceptually there are two views on a file's metadatum: 1. the user's view: when was my data last changed. 2. the system's view: when was this inode last changed.

file modtime is "user's view", while the system view regarding the inode is called "change time", which is not shown on UIs like Explorer:
level:                 |user | inode
-----------------------|-----|-----
modtime (file)         |  X  |
change time (file)     |     |  X
creation time (file)   |     |  X
                       |     |
modtime (folder)       |     |  X
creation time (folder) |     |  X
There's obviously a design issue here, has been all the time, and doesn't look like it's going anywhere.

PS: Thing's look a bit better on macOS where there's ATTR_CMN_CRTIME, a user-level creation time.
Posts: 8
Joined: 31 Jan 2022

Fred64

I was inaccurate earlier about Nirsoft FolderTimeUpdate.

It can set the Creation Date AND the Last Modified Date.

The Modified Time Options
>> no change
>> newest modified time
>> newest created time
>> oldest modified time
>> oldest created time

The Created Time options
>> no change
>> same as the Modifed time result
>> oldest modified time
>> oldest created time

One note: make sure the "exclude hidden and system files" is checked for accurate results.

It works from a GUI or a batch file. I set up a batch file to run it against the directory I was syncing and added it to the .ffs job (under Sync option on completion). Trick was to switch directories int the FolderTime batch file first (CD c:\"WhereLastFloderUpdateLives") followed by its commands.

See: https://www.nirsoft.net/utils/folder_time_update.html