mbt masai
 
Welcome !
         

                                
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)
0
Hi friends ,

how can i use the vbscript to check if a file is being used or not

thank you
#1
    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)
    0
    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?
    #2
      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)
      0
       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
      #3
        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)
        0
        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







        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.8
          mbt shoes www.wileywilson.com