Use endswith. fnmatch is specific to *nix (I think) and so won't work if you are using MS Windows.
if os.path.isfile(fullname):
# Only work on VOBs and MPGs (for now)
if filename.endswith('.vob') or filename.endswith('.mpg'):
f.write('dgindex.exe -IF=[%s] -FO=0 -OM=0 -OF=[%s] -MINIMIZE -EXIT \n' % \
(fullname, fullname))
##
## You could also slice off the end if you have a lot of different endings
ending_tuple=( ".mpg", ".vob" )
ending = filename[-4:]
if ending in ending_tuple:
##write to file
woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714