PC Review


Reply
Thread Tools Rate Thread

DeleteFile() returning ERROR_FILE_NOT_FOUND

 
 
Andy Nugent
Guest
Posts: n/a
 
      17th Sep 2004
As part of the clean up from my application I delete a series of temporary
files using DeleteFile(). However, some of the delete's work, and some
don't. The ones that don't return ERROR_FILE_NOT_FOUND.

I've used the handle utility from SysInternals to check if I have any
handles open to these files when I try and delete them and I don't.

I'm also outputting to the trace the full paths of the files, and I'm sure
that the path is correct (e.g. I cut and paste it into a delete command at
the DOS prompt and it works).

Also, if I put a break point on the call to DeleteFile() and then go into
explorer and delete the files manually everything works.

So... does anyone have any idea what is going wrong?

I'm fed up of looking at it and will probably just change the code to use
SHFileOperation() on Monday morning, but I'd be really interested in an
explanation of what's happening.

Thanks,

Andy.



 
Reply With Quote
 
 
 
 
Dave August
Guest
Posts: n/a
 
      22nd Sep 2004
Or use FILE_FLAG_DELETE_ON_CLOSE in your CreateFile call....

It'll only delete the file when ALL open handles are closed...

Dave

> I'm fed up of looking at it and will probably just change the code to use
> SHFileOperation() on Monday morning, but I'd be really interested in an
> explanation of what's happening.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DeleteFile() not working in XP HD Windows XP General 2 16th Feb 2007 08:57 PM
object.DeleteFile =?Utf-8?B?eW91c2Vm?= Microsoft Access 2 28th Mar 2006 12:13 PM
Can't DeleteFile from system32 Microsoft Windows 2000 Active Directory 0 17th Feb 2005 11:15 PM
ShellExecute for an http: URL gets ERROR_FILE_NOT_FOUND Clark Wilson Microsoft Windows 2000 Registry Archive 0 25th Sep 2004 06:07 PM
ShellExecute for an http: URL gets ERROR_FILE_NOT_FOUND Clark Wilson Microsoft Windows 2000 Registry 0 25th Sep 2004 06:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 PM.