473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

roberttonafelix
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
Oct 31 '12 #1

✓ answered by bvdet

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

3 1943
dwblas
626 Expert 512MB
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).
Oct 31 '12 #2
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
Nov 1 '12 #3
bvdet
2,851 Expert Mod 2GB
There is no way to do this on Windows that I am aware of. I've looked!
Nov 1 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Raj Batra | last post by:
Hi, I've created a dll that you can import into python. The function calls an ostringstream class. Calling this function repeatedly in python will cause a Microsoft Visual C++ Debug Library...
8
by: Sridhar R | last post by:
Hi, I am a little experienced python programmer (2 months). I am somewhat experienced in C/C++. I am planning (now in design stage) to write an IDE in python. The IDE will not be a simple...
13
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
1
by: santhosh kumar | last post by:
hi all.... i'm an newbie to xml how to transform the data which is obtained dynamically to xml file in Python programming language any comments will be thankfull
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
1
by: whitfieldd | last post by:
I am fairly new to the python language. I need to retieve data (XML file data) from http post using python. Are there any libraries that can point me in the right direction? Thanks for your...
1
by: ShaheerAbdulrahiman | last post by:
Hi All, How can we get the file names in a folder using python? Could you please help me....? Thanks and Regards, Shaheer
21
by: =?ISO-8859-1?Q?Rog=E9rio_Brito?= | last post by:
Hi, All. I'm just getting my feet wet on Python and, just for starters, I'm coding some elementary number theory algorithms (yes, I know that most of them are already implemented as modules, but...
2
by: Royt | last post by:
Hi, I'm a newbie to Python, but I think it won't be too hard to learn. A few days ago I registered Google App Engine, it only support Python 2.5. I want to set my blog on it soon. But it's not easy...
0
by: Kevin Aziz | last post by:
I'm very new to python (about two days experience) and have made a few basic programs so far. Now I want to try to make a program in which the user will input a file name and the file will execute,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.