File time and size

On 23/05/2018 at 23:49, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R19 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;


I am using BrowseFiles to iterate over the files in a directory and get each file's creation / modification time as well as the file's size in order to built up some kind of caching.

Later on, when I am -from within the plugin- writing (or reading) a file from that directory I want to update the cache. But to obtain the file's time and size I need to create a BrowseFiles, initialize it with the directory, and scan the whole directory until I reach the file with the filename I just saved, in order to use the GetFileTime() and GetSize().

I did find that BaseFile provides a GetLength() method, but I am missing the most important one, which is to get the file's modification time. Is there any other solution besides using BrowseFiles?

Just to complete the background information: FileMonitor is of no use to me in this project, since the caching is meant to be used over different sessions of Cinema 4D. I also don't need to remain in sync in real-time. Only need to sync when accessing a file which is potentially updated, which is why I prefer to use the scenario of checking the file's modification time.

On 24/05/2018 at 06:54, xxxxxxxx wrote:


LocalFileTime in combination with GeGetFileTime() is what you are looking for (LocalFileTime manual).

On 24/05/2018 at 07:11, xxxxxxxx wrote:

Thanks Andreas,

And I thought I had read all there was to read.

Apologies for not reading the LocalFileTime manual in more details.
It would have avoided the question in the first place. Sorry!

On 24/05/2018 at 07:32, xxxxxxxx wrote:

No worries. To be totally honest, although I had written these manuals, Sebastian had to remind me of these functions... 😉