File is used by another program how to find this using python?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roberttonafelix
    New Member
    • Oct 2012
    • 16

    File is used by another program how to find this using python?

    hi,

    In a folder there are 10 files, in that 3 files are in used by another process i want to pick only the files which was in not in use....

    If the Python script is available kindly share with me...

    Thanks in Advance,

    Robert.J
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    Take a look at the manpage for lsof (list open files). You would have to parse the output to find the directory and file name(s).

    Comment

    • roberttonafelix
      New Member
      • Oct 2012
      • 16

      #3
      i am not getting the result exactly with Isof i am using the windows 7 and python 2.7 version...
      Using Isof i can get the CPU utilities but i required the current status of a file, whether the file is opened by another process or not...
      Eg:
      If i have a folder in that 10 text files are there and 5 files are currently opened by another application and using the files i want the total file names and also the files which are current in use...
      Thanks for your response...

      Regards,
      Robert.J

      Comment

      • bvdet
        Recognized Expert Specialist
        • Oct 2006
        • 2851

        #4
        There is no way to do this on Windows that I am aware of. I've looked!

        Comment

        Working...