Comparison of the document tree

With the python 2 file tree, the different output.
For example, the a document tree, B tree, B and a in different part of the input.
Thank God.

Started by Cher at December 12, 2016 - 2:30 AM

The document tree ?

Posted by Clare at December 13, 2016 - 2:46 AM

The " {path}-{file}" in order to facilitate the comparison of segmentation is added in, of course, if the file or path name inside a " -" words, can use " -" for others you can use, for example"|"
Difference set is used for the different operations, so basically, in addition to the file format to save, basically I don't what to do different, system function to do, ha ha.
  1. def fetch_file_info(dirname):
  2. result = []
  3. for root, path, files in os.walk(dirname):
  4. for file_item in files:
  5. result.append("{path}-{file}".format(path=path,file=file_item))
  6. return result

  7. def compare_file_info(first_folder, second_folder):
  8. result = set(first_folder).difference(set(second_folder))
  9. return result

  10. def main():
  11. dir1 = fetch_file_info(r"D:\tools\Lib") # This is my ironpython lib Library
  12. dir2 = fetch_file_info(r"D:\tools\App\Lib") # This is my Cpython lib Library,
  13. result = compare_file_info(dir1, dir2)
  14. import pprint
  15. pprint.pprint(result)
Just use this comparison the two libraries are not the same as what file, ha ha

PS: just came back and edited, because start of file information collection do too coarse.
So the fetch_file_info function change in the. Forgive me!

Posted by Maggie at December 28, 2016 - 3:00 AM