Home All Groups Group Topic Archive Search About

Check File Permissions and Usage

Author
18 May 2006 9:43 PM
John Wright
I have a program that needs to update a file at times.  Is there a way to
check to see if the file is in use and force an update on the file.  The
file I need to update is not used by anyone, but a process on the machine
may have had it open and not released it.  Any suggestions are appreciated.

John

Author
18 May 2006 10:12 PM
Herfried K. Wagner [MVP]
"John Wright" <riley_wri***@notmail.com> schrieb:
>I have a program that needs to update a file at times.  Is there a way to
>check to see if the file is in use and force an update on the file.  The
>file I need to update is not used by anyone, but a process on the machine
>may have had it open and not released it.

You may want to delay moving the file until the next reboot of the system:

Platform SDK: File Systems -- 'MoveFileEx'
<URL:http://msdn.microsoft.com/library/en-us/fileio/base/movefileex.asp>

+ 'MOVEFILE_DELAY_UNTIL_REBOOT'.

How To Move Files That Are Currently in Use
<URL:http://support.microsoft.com/?scid=kb;EN-US;140570>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
19 May 2006 2:37 PM
John Wright
This is NOT an option.  The file must be moved immediately.

John
Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:eKnoigseGHA.4948@TK2MSFTNGP04.phx.gbl...
> "John Wright" <riley_wri***@notmail.com> schrieb:
>>I have a program that needs to update a file at times.  Is there a way to
>>check to see if the file is in use and force an update on the file.  The
>>file I need to update is not used by anyone, but a process on the machine
>>may have had it open and not released it.
>
> You may want to delay moving the file until the next reboot of the system:
>
> Platform SDK: File Systems -- 'MoveFileEx'
> <URL:http://msdn.microsoft.com/library/en-us/fileio/base/movefileex.asp>
>
> + 'MOVEFILE_DELAY_UNTIL_REBOOT'.
>
> How To Move Files That Are Currently in Use
> <URL:http://support.microsoft.com/?scid=kb;EN-US;140570>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>