Hi all,
Does anybody know a way, in VB.Net, I can discover the file locks on a file
on the local machine. I have an application which needs to delete specific
files, but I would like to verify in advance whether or not a particular
deletion will succeed. Due to other pre-deletion actions, I cannot attempt
the deletion and catch the exception if it fails.
Thanks in advance
Justin 2 1811
Hi, Justin
As locks are dynamic in such cases your best bet would be to use try/catch
around the code. I am not sure I can see why pre-delete actions are not
allowing you to use this simple and efficient approach. Would you care to
explain?
HTH
Alex
"Justin" <ju****@discussions.microsoft.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl... Hi all,
Does anybody know a way, in VB.Net, I can discover the file locks on a
file on the local machine. I have an application which needs to delete specific files, but I would like to verify in advance whether or not a particular deletion will succeed. Due to other pre-deletion actions, I cannot attempt the deletion and catch the exception if it fails.
Thanks in advance
Justin
Hi Alex,
Thanks for your reply.
The reason I wanted to 'pre-validate' the deletion is because I need to unregister the file for COM, prior to deletion. If I do not do this and the deletion succeeds I have missed my opportunity to do the unregistration. So I unregister and try to delete, if the deletion fails I have an 'undo' process that re-registers the file.
This solution does work. I had just wondered if there was a straight forward way of checking, prior to deletion. If, as it appears, there is not then so be it, I will stick to the solution I have.
Thanks
Justin
"AlexS" wrote: Hi, Justin
As locks are dynamic in such cases your best bet would be to use try/catch around the code. I am not sure I can see why pre-delete actions are not allowing you to use this simple and efficient approach. Would you care to explain?
HTH Alex
"Justin" <ju****@discussions.microsoft.com> wrote in message news:uC**************@TK2MSFTNGP09.phx.gbl... Hi all,
Does anybody know a way, in VB.Net, I can discover the file locks on a file on the local machine. I have an application which needs to delete specific files, but I would like to verify in advance whether or not a particular deletion will succeed. Due to other pre-deletion actions, I cannot attempt the deletion and catch the exception if it fails.
Thanks in advance
Justin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pekka Niiranen |
last post by:
Hi,
I have used the following example from win32 extensions:
-----SCRIPT STARTS----
import win32file
import win32con
import win32security
import pywintypes
|
by: Anurag |
last post by:
Hi,
I understand that the dbm cfg parameter "DISCOVER" controls whether
Search or Known discovery is applicable. Additionally, Search discovery
provides a superset of Known discovery. I completely...
|
by: Stephen Corey |
last post by:
I'm writing an app that basically just appends text to a text file on a
Win2K Server. They fill out a form, click a button, and 1 line is
appended to the file. Multiple people will run this app at...
|
by: martin |
last post by:
Hi,
I have noticed that every aspx page that I created (and ascx file) has an
assosiated resource file aspx.resx.
However what I would like to do is have a single global resource file for
the...
|
by: Justin |
last post by:
Hi all,
Does anybody know a way, in VB.Net, I can discover the file locks on a file
on the local machine. I have an application which needs to delete specific
files, but I would like to verify...
|
by: Matt D |
last post by:
I've got two web services that use the same data types and that
clients will have to consume. I read the msdn article on sharing types...
|
by: ABCL |
last post by:
Hi All,
I am working on the situation where 2 different
Process/Application(.net) tries to open file at the same time....Or one
process is updating the file and another process tries to access...
|
by: Chris Mullins |
last post by:
I'm in the process of building a number of (Web) Services using .NET 3.0 and
WCF. These services are intended to be deployed within the Intranet of a
very, very large orginization.
I need to...
|
by: news.microsoft.com |
last post by:
Hey All,
Sorry to post to several groups but wasn't sure which development group
would be best for the question.
I was wondering if there are any developers out there that have significant...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
| |