On 8/15/05, Simon Gerber <[EMAIL PROTECTED]> wrote: > You could probably do something like this... (Note: This example is > for Linux - but you can adapt it fairly easily to Windows.) > > > # E.g. Find every .inf file on a CD-ROM. > path = '/cdrom' > # 'E:\\' or whatever for Windows.... > inf_list = [] > for root, dirs, files in os.walk(path): > for current_file in files: > if '.inf' in current_file:
if current_file.endswith('.inf'): #or current_file[:-4] might be more appropriate, just my 2c I wrote this in a script for limited globbing: if cd: toss = os.path.join(trashcan, os.path.split(i)[1]) pwd = os.getcwd() else: toss = os.path.join(trashcan, i) if toss[-1] == '*': crumple = [] if cd: l = os.listdir(cd) for i in l: crumple.append(os.path.join(cd, i)) else: crumple = os.listdir('.') for i in crumple: if i.startswith(toss[:-1]): junk.append(i) _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor