Functions | |
def | output |
def | build_file_index_for |
def | build_name_index_for |
def | display_content_duplicates |
def | display_name_duplicates |
def | compare_content_trees |
def | compare_name_trees |
def | check_content_completeness |
def | check_name_completeness |
def | write_hashes |
Variables | |
string | __doc__ |
log_file = None | |
tuple | base_write_path = os.path.expanduser("~") |
tuple | file_base_name = time.strftime( "%Y%m%d-tree-file-compare.log", time.gmtime() ) |
tuple | log_filename = os.path.join( base_write_path, file_base_name ) |
list | help_options = [ '-h', '--help' ] |
list | verbose_options = [ '-v', '--verbose' ] |
list | by_name_options = [ '--by-name-only' ] |
options = help_options+verbose_options+by_name_options | |
verbose = False | |
compare_by_content = True | |
list | saved_args = sys.argv[1:] |
int | item_count = 0 |
reference_path = None | |
mirror_path = None | |
tuple | item = sys.argv.pop(0) |
item_understood = False | |
tuple | ref_name_index = build_name_index_for( reference_path ) |
tuple | mirror_name_index = build_name_index_for( mirror_path ) |
def tree_file_compare::build_file_index_for | ( | path | ) |
Creates two (dictionary-based) file index for specified path.
Definition at line 58 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 96 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 180 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 191 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 147 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 163 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 123 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 135 of file tree_file_compare.py.
def tree_file_compare::output | ( | message | ) |
Definition at line 52 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 202 of file tree_file_compare.py.
string tree_file_compare::__doc__ |
Initial value:
""" Usage: tree-file-compare.py [ -h | --help ] [ -v | --verbose ] [ --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 """
Definition at line 7 of file tree_file_compare.py.
tuple tree_file_compare::base_write_path = os.path.expanduser("~") |
Definition at line 44 of file tree_file_compare.py.
list tree_file_compare::by_name_options = [ '--by-name-only' ] |
Definition at line 216 of file tree_file_compare.py.
Definition at line 222 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 46 of file tree_file_compare.py.
list tree_file_compare::help_options = [ '-h', '--help' ] |
Definition at line 214 of file tree_file_compare.py.
tuple tree_file_compare::item = sys.argv.pop(0) |
Definition at line 238 of file tree_file_compare.py.
int tree_file_compare::item_count = 0 |
Definition at line 231 of file tree_file_compare.py.
Definition at line 239 of file tree_file_compare.py.
tuple tree_file_compare::log_file = None |
Definition at line 41 of file tree_file_compare.py.
tuple tree_file_compare::log_filename = os.path.join( base_write_path, file_base_name ) |
Definition at line 48 of file tree_file_compare.py.
tuple tree_file_compare::mirror_name_index = build_name_index_for( mirror_path ) |
Definition at line 316 of file tree_file_compare.py.
tuple tree_file_compare::mirror_path = None |
Definition at line 234 of file tree_file_compare.py.
Definition at line 218 of file tree_file_compare.py.
tuple tree_file_compare::ref_name_index = build_name_index_for( reference_path ) |
Definition at line 299 of file tree_file_compare.py.
tuple tree_file_compare::reference_path = None |
Definition at line 233 of file tree_file_compare.py.
list tree_file_compare::saved_args = sys.argv[1:] |
Definition at line 226 of file tree_file_compare.py.
tree_file_compare::verbose = False |
Definition at line 221 of file tree_file_compare.py.
list tree_file_compare::verbose_options = [ '-v', '--verbose' ] |
Definition at line 215 of file tree_file_compare.py.