Python script runnable with CLI and argument, or directly with input
import sys
import os
if __name__ == "__main__": # When the script is run
if len( sys.argv ) == 1: # Check if it was run with an argument
dir = input("Folder?\t") # If no, ask for user input
else:
dir = sys.argv[1] # Take first argument of the command
if os.path.isdir( dir ) == False: # Does the folder exists?
sys.exit("Folder doesn't exist.") # then kill the script
# A valid folder is passed as argument
print("The folder exist!") # Your action