473,770 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check for locked file

How can I check if a file is in use, I have file and I want to know if
someone have the file opened for writing, I dont care if they have opened
the file readonly.

The type of file can be all types.

Erik Fjelldal
Nov 23 '05 #1
1 1546
try to open the file exclusive , if you can`t do that ( error is raised but
ofcourse catched by you ) the file is already opened by someone else

regards

Michel Posseth [MCP]
"Erik Fjelldal" <Er***@newsgrou p.nospam> wrote in message
news:u7******** *****@TK2MSFTNG P10.phx.gbl...
How can I check if a file is in use, I have file and I want to know if
someone have the file opened for writing, I dont care if they have opened
the file readonly.

The type of file can be all types.

Erik Fjelldal

Nov 23 '05 #2

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

Similar topics

6
10528
by: Pierre-Yves | last post by:
Hello, I would like to prevent my perl program to be executed several times simultaneously (if the program is already running, I would like to display a message like "another instance of this program is already running, please try again in a couple of minutes). For doing this, I guess I have to check the running processes... but I don't know how to do that and how I can identify my program in the running processes.
2
18796
by: Ken Durden | last post by:
I'm setting up an interface where clients must perform external locking before calling certain commands. I do this to force them to specify the duration the action they performed must persist before any other threads can be allowed to perform some action. My object exposes a Mutex which is locked via a IDisposable-Sentry class. I want to throw an exception if certain functions are called without this Mutex already being locked, but I...
2
2820
by: Janice | last post by:
How to obtain the lock status of a file held by other process? If I read the file that is locked by other process, the read would return -1. If the file is locked by other process, how to put the read to sleep for a second and try again after a period of time? Thanx
4
2765
by: hkappleorange | last post by:
I ued this code to connect to a mdb file A = New OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\Inetpub\wwwroot\ASPX\Authors.mdb" )
0
1190
by: Peter | last post by:
Question one: How do you detect if a file is locked. I have a program that is cleaning up a temp directory and I want to scan the files to see if they are locked before I try to delete them. Question Two: If the file is locked and I have admin privilages how do you take ownership of the file and then delete it?
4
8715
by: Xero | last post by:
hello. how do you check if a file (say, a txt one) is being used by another process? thanks. -- Xero http://www.chezjeff.net My personal web portal
5
20280
by: cmay | last post by:
The only examples I have seen on how to check if a file is locked is to try to open it a catch an exception. MS has stated that you should never use error trapping in this manner. Is there no other way to identify if a file is locked w/o trapping an exception?
6
6030
by: elake | last post by:
I found this thread about a pst file in Windows being locked and I am having the same issue. http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locked+files%27&rnum=1 The problem is that I have a script that can find the pst files on every machine in my network and back them up to a server for safe keeping. The problem is that when Outlook is running it locks the...
1
3240
by: Joe | last post by:
any other way than Try / Catch / Finally ??
7
2219
by: xerc | last post by:
Hey all, So I have a script that runs pretty much every 5 minutes or so to look for updated files locally on a server. New files (ranging in size from 1KB - 2MB) are then FTP'd to another server. Without going into detail, one server is a content server, the other is a 'broadcast' server. Anywho, the problem seems to be with the FTP part. I'd say about 20 percent of the time, regardless of file size, something hangs up, such that the file...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.