Beispiel #1
0
 def check_exists_recursive(self, filepath_tree):
     filepath = FilePath()
     for location in filepath_tree.locations:
         filepath.add(location)
         if not self.check_is_folder(filepath):
             return filepath
     return True
    file_rule = create_file_rule(regex)
    process = create_process(file_manager, process)

    rule = Rule(file_rule, process, destination)
    filtered = rule.apply_files_rule(origin_files)

    for p in rule.apply_process(filtered):
        input("Enter to continue...")


if __name__ == "__main__":
    file_manager = FileManager()

    test_file_path = FilePath()
    test_file_path.add("origin_folder")
    test_file_path.add("test_file")

    test_destination = FilePath("test_folder")
    file_manager.copy_file(test_file_path, test_destination)

    # # Standard file creation/deletion
    # assert file_manager.check_exists(test_file_path) == False
    # assert file_manager.create_file(test_file_path) == True
    # assert file_manager.check_exists(test_file_path) == True
    # assert file_manager.delete_file(test_file_path) == True
    # assert file_manager.check_exists(test_file_path) == False

    # # Standard folder create/deletion
    # test_folder_path = FilePath("test_folder")
    # assert file_manager.create_folder(test_folder_path) == True