After experiencing a lot of down time, We decided to move this site to
CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.
to check if a file is being used or not
|
Author |
Message
|
akpaga
-
Total Posts
:
19
- Scores: 0
-
Reward points
:
0
- Joined: 11/12/2008
-
Status: offline
|
to check if a file is being used or not
Wednesday, September 08, 2010 8:41 AM
( permalink)
Hi friends , how can i use the vbscript to check if a file is being used or not thank you
|
|
|
|
rasimmer
-
Total Posts
:
2360
- Scores: 163
-
Reward points
:
0
- Joined: 3/19/2009
- Location: Cedar Rapids, IA
-
Status: offline
|
Re:to check if a file is being used or not
Wednesday, September 08, 2010 9:35 AM
( permalink)
Can you be a little more specific? Is it an exe and you want to see if it's being run or you want to delete it and see if it's in use?
|
|
|
|
akpaga
-
Total Posts
:
19
- Scores: 0
-
Reward points
:
0
- Joined: 11/12/2008
-
Status: offline
|
Re:to check if a file is being used or not
Thursday, September 09, 2010 3:30 AM
( permalink)
i want to check if any user has a particualr csv file opened or not i.e he is using it..... i have bcp command running on my sql server which overwrites a csv file but its not doing it when the csv file is open...so before i run the bcp command i would like to check if the file is open and fail the bcp command step if its open. Hoep i am clear..thank you
|
|
|
|
ehvbs
-
Total Posts
:
3312
- Scores: 110
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
Re:to check if a file is being used or not
Thursday, September 09, 2010 5:04 AM
( permalink)
In general, operations involving locks should be atomic: you try to claim a resource and either get it or not. Testing for availability now and using the resource later is risky/futile, because the resource's status may change in between. So I would put efforts in making sure that the bcp process will 'do the right thing' even if the .csv is locked. Depending on special circumstances, you can use/shell out to "net files" or "openfiles.exe" look for sentinel files (used by office apps) try to rename or delete the .csv
|
|
|
|
Online Bookmarks Sharing: