Walking recursivly through a directory-structure

Darrell Gallion darrell at dorb.com
Mon May 29 14:38:51 EDT 2000


Just needed this last night. While trying to use cvs_chroot from
http://starship.python.net/~gward/python/

def find_cvs_dirs (start_dir):
#    p = os.popen("find %s -type d -name CVS" % start_dir, "r")
    files = []
    def walker(fileList,top, files):
        for file in files:
            if file=="CVS":
                fullName = top+os.sep+file
                fileList.append(fullName)

    os.path.walk(".", walker, files)
    return files

"Pål Sollie" <sollie at saint-etienne.no> wrote in message
news:m3og5pcsvi.fsf at rancid.apocalypse.no...
> I've been looking at os.path.walk for this, but I'm not sure how to
> implement it. Anyone able to point me in the rigth direction?
>
> --
> Pål Sollie
> sparkz at ikke.no
> sollie at bitemyshinymetalass.com
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list