Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

File time and size

Author
Message
  Topic Search Topic Search
C4DS View Drop Down
Member
Member


Joined: 2015 Dec 01
Online Status: Offline
Posts: 235
Direct Link To This Post Topic: File time and size
    Posted: 2018 May 23 at 11:49pm

User Information:

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

---------

Hi,

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.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 May 24 at 6:54am
Hi,

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

Cheers,
Andreas
SDK Support Engineer
Back to Top
C4DS View Drop Down
Member
Member


Joined: 2015 Dec 01
Online Status: Offline
Posts: 235
Direct Link To This Post Posted: 2018 May 24 at 7:11am
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!
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 May 24 at 7:32am
No worries. To be totally honest, although I had written these manuals, Sebastian had to remind me of these functions... Wink
Cheers,
Andreas
SDK Support Engineer
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.