473,386 Members | 1,726 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,386 software developers and data experts.

File being used



Do you have any idea of how I can find out if a file in a
directory is being used by a user or application without
trying to open/delete/... the file? (Just getting the
file status)
It would be highly appreciated if you reply me.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 3540
Cor
Do you have any idea of how I can find out if a file in a
directory is being used by a user or application without
trying to open/delete/... the file? (Just getting the
file status)


Did you look at the fileinfo class?
I don't see any information in the attributes about "used".
But why are you not doing after evaluating the attribute information a
\\
try
'open does not matter how a file
catch ex as exeption
'check the exeption
finally
'close file
end try
///
I hope this helps a little bit
Cor

Nov 20 '05 #2
Hello,

"Cor" <no*@non.com> schrieb:
Did you look at the fileinfo class?
I don't see any information in the attributes about "used".
But why are you not doing after evaluating the attribute
information a
\\
try
'open does not matter how a file
catch ex as exeption
'check the exeption
finally
'close file
end try
///
I hope this helps a little bit


There is a _little_ problem: If the file is not used by an other
application, opening it may change the file date (last access).

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
Cor
Herfried,
This did remind me on a promise I did make last night.
I putted it by the notepad thread,
Then I thought why not test what Herfried said (normaly I don't do that), it
was in one route,
but I was busy with the other things, and I think Fergus and I are both very
quick typers.
Here it is, test it if you want after you did the other one, then the file
is on disk.
\\\\
Dim sr As StreamReader
Dim a As New FileInfo("C:\Armin")
Try
sr = New StreamReader("C:\Armin")
Finally
sr.Close()
End Try

Threading.Thread.Sleep(10000)
Dim b As New FileInfo("C:\Armin")
MessageBox.Show(a.LastAccessTime.ToString & "|" &
b.LastAccessTime.ToString)
////
But you know of course the answer already.

:-))

Or maybe I have another computer than you.
Cor

PS, I left that Doornbos thing for you, yesterday, you said only "NO" so I
thought now you would say only "YES"
:-))
Nov 20 '05 #4

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

Similar topics

20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
3
by: John Bailo | last post by:
With OS400, all files are objects that can be accessed relationally. When I view the file system from Navigator (windows client), I see there is the Database and SQL tables, then there is the...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
13
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
5
by: sonu | last post by:
hey good morning ...... how to convert a video file in .flv format in php for linux hosting......is there any package whis provide this facility . Can i use ffmpeg for linux hosting...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.