Re: Search for a file

From: Thomas Guettler (
Date: 06/10/04

Date: Thu, 10 Jun 2004 16:21:47 +0200

Am Thu, 10 Jun 2004 02:33:15 -0700 schrieb mithuna g:

> Hi All,
> I am new user of python. I would like to have your suggestions to do a task.
> Given a file name say a.c, is there any possiblity that will help in
> finding the location
> of the file.


If you use unix try "locate". If locate
is not installed, try "find / -name 'a.c'"

If you want to do this in python, have
a look at os.listdir(). You need a recursive
function since you want to search in sub-directories,

Or try os.path.walk()


Relevant Pages

  • Re: sync dirs
    ... I've used that several times with great satisfaction, and it's fairly low-end - all you need is an FTP server at the other end. ... installer (or, at least, I have it somehow in my Windows Python 2.4, but ... not in my Cygwin Python 2.4. ...
  • Re: Interpreter problem
    ... Of course you could just read and write the file in Python in text mode, that might get rid of the returns. ... There's probably a vim mode you can set to display the extraneous characters - it normally screams "^M" at me for files with carriage returns in them. ...
  • Re: Success Natively Compiling Python-2.3.4 in Mingw?
    ... > Regards, Fernando ... Hello Fernando, ... check out the pyMinGW patch here: ... Python compiled under MinGW. ...
  • Re: is this data structure build-in or Ill have to write my own class?
    ... assert dict.items==a ... structure of Python. ... - maintain the order (for iter and print) ...
  • Re: Generating .pyc/.pyo from a make file
    ... > distribution strategy would be to have the installation program generate ... Steve ... Meet the Python developers and your favorites March 23-25 ...