def tree_file_compare::build_file_index_for | ( | path | ) |
Creates two (dictionary-based) file index for specified path.
Definition at line 59 of file tree_file_compare.py.
def tree_file_compare::build_name_index_for | ( | path | ) |
Creates one (dictionary-based) name index for specified path.
Definition at line 97 of file tree_file_compare.py.
def tree_file_compare::check_content_completeness | ( | ref_content_index, | ||
mirror_content_index | ||||
) |
Checks that all content of mirror tree is in reference tree, preferably with the same filenames.
Definition at line 181 of file tree_file_compare.py.
def tree_file_compare::check_mirror_completeness | ( | ref_content_index, | ||
mirror_content_index | ||||
) |
Checks that all content of reference tree is in mirror tree, preferably with the same filenames.
Definition at line 192 of file tree_file_compare.py.
def tree_file_compare::check_name_completeness | ( | ref_name_index, | ||
mirror_name_index | ||||
) |
Checks that all name of mirror tree is in reference tree, preferably with the same filenames.
Definition at line 203 of file tree_file_compare.py.
def tree_file_compare::compare_content_trees | ( | ref_content_index, | ||
mirror_content_index | ||||
) |
Compares the reference and mirror trees, based on the file content. Useful to know whether a mirror is complete.
Definition at line 148 of file tree_file_compare.py.
def tree_file_compare::compare_name_trees | ( | ref_name_index, | ||
mirror_name_index | ||||
) |
Compares the reference and mirror trees, based on the file name. Useful to know whether a mirror is complete.
Definition at line 164 of file tree_file_compare.py.
def tree_file_compare::detect_common_content | ( | ref_content_index, | ||
mirror_content_index | ||||
) |
Useful in the cases where one wants to check two trees partition indeed a set of files (we do not want the same content to appear more than once). Common files are detected in terms of content.
Definition at line 214 of file tree_file_compare.py.
def tree_file_compare::detect_common_name | ( | ref_name_index, | ||
mirror_name_index | ||||
) |
Useful in the cases where one wants to check two trees partition indeed a set of files (we do not want the same content to appear more than once). Common files are detected in terms of name.
Definition at line 231 of file tree_file_compare.py.
def tree_file_compare::display_content_duplicates | ( | root_path, | ||
content_index | ||||
) |
Displays the duplicates in specified content file index.
Definition at line 124 of file tree_file_compare.py.
def tree_file_compare::display_name_duplicates | ( | root_path, | ||
name_index | ||||
) |
Displays the duplicates in specified name file index.
Definition at line 136 of file tree_file_compare.py.
def tree_file_compare::output | ( | message | ) |
Definition at line 53 of file tree_file_compare.py.
def tree_file_compare::write_hashes | ( | log_file, | ||
content_index | ||||
) |
Writes specified content index in specified log file.
Definition at line 248 of file tree_file_compare.py.
string tree_file_compare::__doc__ |
""" Usage: tree-file-compare.py [ -h | --help ] [ -v | --verbose ] [ -r | --reverse] [ --by-name-only ] --reference APath [--mirror AnotherPath] Will scan first specified tree, in search of duplicated files (same content, different path). The resulting associations will be stored in ~/*-tree-file-compare.log files. If a second tree is specified (--mirror option), then will look for files whose content is in second tree but not in the first one, to ensure the reference tree is complete. This script is useful to ensure a reference tree does not lack any content from a mirror and to know whether the mirror is up-to-date. The script can be used for example for snapshots or archives. Options: -v or --verbose: set verbose mode --by-name-only: comparison is done based on names only; no MD5 checksum performed (useful when the names refer clearly to the content, as an archive filename, as opposed to snapshots) --mirror A_PATH: specifies a second tree to compare with --reverse: reverse-compare, i.e. search for files that are common to both trees rather than lacking in one (useful to ensure there is no duplicate between trees) """
Definition at line 7 of file tree_file_compare.py.
tuple tree_file_compare::base_write_path = os.path.expanduser("~") |
Definition at line 45 of file tree_file_compare.py.
list tree_file_compare::by_name_options = [ '--by-name-only' ] |
Definition at line 262 of file tree_file_compare.py.
Definition at line 269 of file tree_file_compare.py.
tuple tree_file_compare::file_base_name = time.strftime( "%Y%m%d-tree-file-compare.log", time.gmtime() ) |
Definition at line 47 of file tree_file_compare.py.
list tree_file_compare::help_options = [ '-h', '--help' ] |
Definition at line 260 of file tree_file_compare.py.
tuple tree_file_compare::item = sys.argv.pop(0) |
Definition at line 286 of file tree_file_compare.py.
int tree_file_compare::item_count = 0 |
Definition at line 279 of file tree_file_compare.py.
Definition at line 287 of file tree_file_compare.py.
tuple tree_file_compare::log_file = None |
Definition at line 42 of file tree_file_compare.py.
tuple tree_file_compare::log_filename = os.path.join( base_write_path, file_base_name ) |
Definition at line 49 of file tree_file_compare.py.
tuple tree_file_compare::mirror_name_index = build_name_index_for( mirror_path ) |
Definition at line 389 of file tree_file_compare.py.
tuple tree_file_compare::mirror_path = None |
Definition at line 282 of file tree_file_compare.py.
Definition at line 265 of file tree_file_compare.py.
tuple tree_file_compare::ref_name_index = build_name_index_for( reference_path ) |
Definition at line 372 of file tree_file_compare.py.
tuple tree_file_compare::reference_path = None |
Definition at line 281 of file tree_file_compare.py.
Definition at line 270 of file tree_file_compare.py.
list tree_file_compare::reverse_options = [ '-r', '--reverse' ] |
Definition at line 263 of file tree_file_compare.py.
list tree_file_compare::saved_args = sys.argv[1:] |
Definition at line 274 of file tree_file_compare.py.
tree_file_compare::verbose = False |
Definition at line 268 of file tree_file_compare.py.
list tree_file_compare::verbose_options = [ '-v', '--verbose' ] |
Definition at line 261 of file tree_file_compare.py.