Re: Flag a file to be deleted
- Posted by Eucoder <eucoder at hotmail.com> Nov 13, 2004
- 508 views
> Moving Files in Windows NT > > Win32-based applications running on Windows NT should use MoveFileEx() > with the MOVEFILE_DELAY_UNTIL_REBOOT flag to move, replace, or delete > files and directories currently being used. The next time the system > is rebooted, the Windows NT bootup program will move, replace, or > delete the specified files and directories. > > To move or replace a file or directory that is in use, an application > must specify both a source and destination path on the same volume > (for example, drive C:). If the destination path is an existing file, > it will be overwritten. If the destination path is an existing > directory, it will not be overwritten and both the source and > destination paths will remain unchanged. Here is an example call to > move or replace a file or move a directory: > > // Move szSrcFile to szDstFile next time system is rebooted > MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT); > > To delete a file or directory, the application must set the > destination path to NULL. If the source path is a directory, it will > be removed only if it is empty. Note that if you must use MoveFileEx() > to remove files from a directory, you must reboot the computer before > you can call MoveFileEx() to remove the directory. Here is an example > of how to delete a file or empty a directory: > > // Delete szSrcFile next time system is rebooted > MoveFileEx(szSrcFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); > > > >From <a > >href="http://support.microsoft.com/default.aspx/kb/140570/EN-US/">http://support.microsoft.com/default.aspx/kb/140570/EN-US/</a> > > Thanks! That seems like what I need