Forums Register Login

How do I check if a file is open by any process?

+Pie Number of slices to send: Send
Hello,
How do I check if a certain file on the client desktop is open by any process?
Here is the scenario: I generate a vb script from an applet to print a pdf file. I do not know how long the file is being printed. So, I want to check of the file is open any process on the machine, so I can delete it when no process is using the file.
Thanks in advance.
Bala.
+Pie Number of slices to send: Send
Bala,
The File class has two methods called canRead( ) and canWrite( ).
I beleive that if you use either of these when they point to your File in question then they will tell you if there is any process maintaining a lock on it.

You might have tried this already, let me know if it solves your problem or not!
Andy.
+Pie Number of slices to send: Send
Hi,
canWrite answers the requirement.When another process is reading the file the canWrite() returns false.
Cheers,
Gaya3
This parrot is no more. It has ceased to be. Now it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 23745 times.
Similar Threads
how to open a file using Process ??
Reading from process table.
RAD Admin console - Page cannot be found
exception in reading a text file
Storing Configuration Information
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:07:35.