Some ideas (guesses).
 
You probably need to look at file sharing options, see if you can enum a list of file shares, or maybe add a listener to a directory and see if you get notified of activity this way.
 
Myles.
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, 18 November 2002 12:44 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Check if file is locked?

I'm confused. I've been told by our Network Admin that you can't rename a locked dll, as it's the same as deleting it. Yet I've just proved I can do it!
 
I went into a DLL (policy maintenance) and started flicking round subforms, then renamed the dll while still in it, and did some updating in the policy screen, then exited policy maint without a problem. When I tried deleting the renamed file (while the dll was running - under the old name?), it said there was a sharing violation and wouldn't let me. So it knew I'd renamed a locked file. The network guy tells me the server I'm doing this on is NT4 - and he says what I'm doing CAN'T be done!
 
Jason, in regard to renaming a locked folder, if you don't find a Windows call to determine if your folder is locked (and I assume there must be one), then you could always make a copy of the folder with your new name, then try deleting the original folder. If deleting the original works, then fine, if not, then something's using it, in which case you could delete the copy you made and thereby know you shouldn't rename it. Convoluted way of doing it - better if you can find the Windows call.
 
Dave
-----Original Message-----
From: Steve Aish [mailto:[EMAIL PROTECTED]]
Sent: Monday, 18 November 2002 12:25
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Check if file is locked?

Do you perchance have Windows 2000?  I have found on Win2k you can usually get away with renaming a file that someone else is using.  This is apparently not possible but works most of the time anyway.
 
Steve
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, 18 November 2002 12:00
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Check if file is locked?

FYI...this morning I had a DLL locked, which I wanted to delete. It wouldn't let me, so I renamed it successfully - even though locked. Not sure if that was because of my rights or whether renaming a locked file always works?
 
Dave
-----Original Message-----
From: Conor Boyd [mailto:[EMAIL PROTECTED]]
Sent: Monday, 18 November 2002 11:54
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Check if file is locked?

Had a look after you posted last week, but couldn't find much, I'm afraid.
 
Will the OS not prevent you from renaming if files are open/locked?  If so, why not just try the rename and catch any exceptions?
 
Cheers,
 
Conor
-----Original Message-----
From: Jason Coley [mailto:[EMAIL PROTECTED]]
Sent: Monday, 18 November 2002 11:50 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Check if file is locked?

Hi all,

 

I am trying to write some code that will rename a folder, but I need to know whether I can, ie no files are open or locked by another process, user etc. So I need to know the quickest and easiest method for finding out whether its OK or not to rename the folder.

 

Does anyone have any suggestions?

 

Jason

 


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.419 / Virus Database: 235 - Release Date: 13/11/2002

Reply via email to