Here is a little program that I write that will create csv by classifying a file directory:
matches = [] for root, dirnames, filenames in os.walk(directory): for filename in fnmatch.filter(filenames, '*[AZ]*'): matches.append([os.path.join(root, filename), "No Capital Letters!"]) test = re.compile(".*\.(py|php)", re.IGNORECASE) for filename in filter(test.search, filenames): matches.append([os.path.join(root, filename), "Invalid File type!"])
In principle, the user selects the folder, and the program indicates the problem files, which can be of several types (only two listed here: without files with capital letters, without php or python files). There will probably be five or six cases.
While this works, I want to reorganize. Is it possible to do something like
for filename in itertools.izip(fnmatch.filter(filenames, '*[AZ]*'), filter(test.search, filenames), ...): matches.append([os.path.join(root, filename), "Violation")
being able to track which of the original unpacked lists caused a "violation?"
source share