Re: Search for a file

From: Thomas Guettler (guettli_at_thomas-guettler.de)
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.

Hi,

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,
too.

Or try os.path.walk()

Regards,
 Thomas