Board index » cppbuilder » File attributes cached?

File attributes cached?


2005-04-11 10:15:08 PM
cppbuilder18
Hi,
I'm writing a function to rotate log files. I use the file creation date to
decide when to rotate the log file. I then rename the file and after that
re-create the log file again. What bugs me is that the newly created file
has the same creation date as the one that was renamed just before. If I add
a delay of a few seconds between the rename and the create, the new file
gets a correct creation date. My guess is that this has something to do with
caching on ntfs. Is there a way around this?
B.t.w., for renaming, I tried all kinds of functions: rename (RTL),
RenameFile (VCL), MoveFile (WinAPI). For creating the file, I used
fopen(..., "at"), CreateFile (WinAPI) and FileCreate (VCL). All with the
same result !
Thanks,
Patrick.
 
 

Re:File attributes cached?

Patrick Rotsaert wrote:
Quote
gets a correct creation date. My guess is that this has something to do with
caching on ntfs. Is there a way around this?
Don't know about fixing it, but getting around it....
SetFileTime()
 

Re:File attributes cached?

Great tip, thanks!
"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
Quote
Patrick Rotsaert wrote:

>gets a correct creation date. My guess is that this has something to do
with
>caching on ntfs. Is there a way around this?

Don't know about fixing it, but getting around it....
SetFileTime()


 

{smallsort}