ModTime() for a directory?

When you do an os.Stat() on a directory, and call the ModTime() function, what does that time.Time mean? Does it mean the last time the directory in itself was changed (moved/renamed/…) or does it mean the last time ANY file in that folder was edited (moved/renamed/content changed/…)? I have tried to find the documentation for this, but I could not find it…

The latter is what I need, but if the first is how it works, then do I really have to loop through all files and subfolders to find out the last time a file was edited? Or is there a better way to get the information I need?

What the value means exactly depends on the filesystem and it’s drivers and settings. I usually deactivate adate and mdate on most of my partitions for performance reasons.

Ok, do you know how it is on (Manjaro) Linux? It feels like modtime for a directory is not what I want.

Should I go for the recursive solution then, and stat all files in the folder?

I’m not aware of manjaros defaults, nor do I know which filesystem you use.

Most likely Ext4 (I have several drives though), but I have decided to go with the recursive solution. There will not be a lot of files in these directories anyway.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.