This code is find and print file extensions from directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import sys import os path = os.path.abspath('.') # default is current dir if len(sys.argv) == 2: path = sys.argv exts =  for root, dirs, files in os.walk(os.path.expanduser(path)): for fn in files: bn, ext = os.path.splitext(fn) if not ext in exts: exts.append(ext) if ext: print ext
Today, we too use time for clean-up files today. It is good to use the file maintenance software made in a search tool OS standard (or 3rd party software), It can checks file extension exists by this code.