Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. Windows - check if file/dir is in use

Windows - check if file/dir is in use

Scheduled Pinned Locked Moved IT & Infrastructure
helpquestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Budric B
    wrote on last edited by
    #1

    Hi, I would like to check if a file or a directory is in use in windows XP. Basically if you open up explorer navigate to some folder, then open another explorer window and try to erase that folder you'll get an error that the folder could not be removed. Unfortunately if you're in some subfolder the delete on parent operation will erase some folders, then hit the problem folder and stop. That's terrible, because you've erased half the stuff before you find out there's a problem. I want to be able to check if anyone's using any of the files/folders, if not then erase them programatically (possibly get a lock so no one can open it while I'm checking the other files). Any help? It must be possible because of programs like FileMon. But I can't get the source code for it.

    V 1 Reply Last reply
    0
    • B Budric B

      Hi, I would like to check if a file or a directory is in use in windows XP. Basically if you open up explorer navigate to some folder, then open another explorer window and try to erase that folder you'll get an error that the folder could not be removed. Unfortunately if you're in some subfolder the delete on parent operation will erase some folders, then hit the problem folder and stop. That's terrible, because you've erased half the stuff before you find out there's a problem. I want to be able to check if anyone's using any of the files/folders, if not then erase them programatically (possibly get a lock so no one can open it while I'm checking the other files). Any help? It must be possible because of programs like FileMon. But I can't get the source code for it.

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      There should be an API to detect if there are open handles on a particular file. At least, there is a utility called 'Task Manager Extension' in CodeProject which is able to enumerate through the open handles on a file. Check out http://www.codeproject.com/system/Task_Manager_Extension.asp[^]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups