1#!/usr/bin/env python 2 3from __future__ import print_function 4 5import os 6import sys 7 8 9def check_path(argv): 10 if len(argv) < 3: 11 print("Wrong number of args") 12 return 1 13 14 type = argv[1] 15 paths = argv[2:] 16 exit_code = 0 17 18 if type == 'dir': 19 for idx, dir in enumerate(paths): 20 print(os.path.isdir(dir)) 21 elif type == 'file': 22 for idx, file in enumerate(paths): 23 print(os.path.isfile(file)) 24 else: 25 print("Unrecognised type {}".format(type)) 26 exit_code = 1 27 return exit_code 28 29if __name__ == '__main__': 30 sys.exit (check_path (sys.argv)) 31