akpaga
-
Total Posts
:
19
- Scores: 0
-
Reward points
:
0
- Joined: 11/12/2008
|
to check if a file is being used or not
-
Wednesday, September 08, 2010 8:41 AM
Hi friends , how can i use the vbscript to check if a file is being used or not thank you
|
|
rasimmer
-
Total Posts
:
2363
- Scores: 163
-
Reward points
:
0
- Joined: 3/19/2009
- Location: Cedar Rapids, IA
|
Re:to check if a file is being used or not
-
Wednesday, September 08, 2010 9:35 AM
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
|
Re:to check if a file is being used or not
-
Thursday, September 09, 2010 3:30 AM
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
:
3321
- Scores: 110
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
|
Re:to check if a file is being used or not
-
Thursday, September 09, 2010 5:04 AM
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
|
|