media moreplus py files unique to more pyc spam txt tester __init__ pyc the unique function is the heart of this scriptit performs simple list difference operation when applied to directoriesunique items represent tree differencesand common items are names of files or subdirectories that merit further comparisons or traversals in factin python and laterwe could also use the built-in set object type if we don' care about the order in the results--because sets are not sequencesthey would not maintain any original and possibly platform-specific left-to-right order of the directory listings provided by os listdir for that reason (and to avoid requiring users to upgrade)we'll keep using our own comprehension-based function instead of sets finding tree differences we've just coded directory comparison tool that picks out unique files and directories now all we need is tree walker that applies dirdiff at each level to report unique itemsexplicitly compares the contents of files in commonand descends through directories in common example - fits the bill example - pp \system\filetools\diffall py ""###############################################################################usage"python diffall py dir dir recursive directory tree comparisonreport unique files that exist in only dir or dir report files of the same name in dir and dir with differing contentsreport instances of same name but different type in dir and dir and do the same for all subdirectories of the same names in and below dir and dir summary of diffs appears at end of outputbut search redirected output for "diffand "uniquestrings for further details new( elimit reads to for large files( ecatch same name=file/dir( eavoid extra os listdir(calls in dirdiff comparedirs(by passing results here along ###############################################################################""import osdirdiff blocksize up to per read def intersect(seq seq )""return all items in both seq and seq set(seq set(seq woud work toobut sets are randomly orderedso any platform-dependent directory order would be lost ""return [item for item in seq if item in seq comparing directory trees