Re: Flag a file to be deleted

new topic     » goto parent     » topic index » view thread      » older message » newer message

=0D
E> Does anyone know how to delete a locked file when Windows 2000/XP boots?=

E> I have seen programs flag files to be deleted next time Windows boots up=
,
E> but I can=92t seem to figure this out.


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 http://support.microsoft.com/default.aspx/kb/140570/EN-US/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu