#!/usr/bin/env python3 import os.path, sys invert = False for path in sys.argv[1:]: if path == '--not': invert = True elif not os.path.exists(path) ^ invert: sys.exit(1)