Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- import sys
- import pprint
- def get_directories(path):
- # Get the subdirectories from that desired path
- sub_dirs = list(Path(path).glob('*/'))
- # Here we store the results
- results = []
- for sub_dir in sub_dirs:
- dir_name = sub_dir.as_posix()
- file_check = dir_name + '/CS' + sub_dir.stem + '.csv'
- # We are omitting the files that match the check and adding the others:
- if not Path(file_check).is_file():
- results.append(dir_name)
- return results
- if __name__ == '__main__':
- path = sys.argv[1] # This is the first argument, argv[0] is the name of the script
- # To be simple, just lets print these out
- pprint.pprint(get_directories(path=path))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement