473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Check File Permissions and Usage

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
May 18 '06 #1
2 1384
"John Wright" <ri**********@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/>

May 18 '06 #2
This is NOT an option. The file must be moved immediately.

John
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eK**************@TK2MSFTNGP04.phx.gbl...
"John Wright" <ri**********@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/>

May 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil Powell | last post by:
print_r(is_file("$logPath/$logFileName")); // RETURNS 1 unlink("$logPath/$logFileName"); // RETURNS WARNING: PERMISSION DENIED This code should tell me that the file located at...
7
by: John | last post by:
I can write to this textfile: $fp = fopen("./testfile.txt","w"); but not this html file: $fp = fopen("./testfile.html","w"); How do I get permission to write to a html file?
4
by: Steven | last post by:
Does anyone know if there is a way to check the access permissions of different users using C#? I need to know if a user has full control or if they have read only access or none to a certain...
6
by: Fred W. | last post by:
When my application starts I need to check folder permissions to ensure they have "Full Control" before I let them proceed on. How can I check this permission. Thank you, Fred
4
by: Ed Sutton | last post by:
Is there an easy way to check using .NET 2.0? Thanks in advance, -Ed
1
by: =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post by:
Hello All, Our application write logs to a file in a folder. Before our application starts writing to that file, I want to check if the current user has write access to that file, for example,...
9
by: mazen.s.m | last post by:
I have been trying to find a way to get the Domain and UserName of the user that last modified a file. I know how to get the owner of the file via WMI or Win32, but I can't find a way to get the...
3
by: gareth | last post by:
Hi, Does anyone know of a way of finding out if the currently logged in user has read access to a directory without trying to open the directory?? Thanks gareth
2
by: beary | last post by:
Hello everyone, I posted this in unix/linux but it received no replies, so I assume it was the wrong forum. I'm trying here. I'm in way over my head with file permissions. The directory and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.