Skip to content

Instantly share code, notes, and snippets.

@poliarush
Last active August 29, 2015 14:13
Show Gist options
  • Save poliarush/091ce38c10245145ddbe to your computer and use it in GitHub Desktop.
Save poliarush/091ce38c10245145ddbe to your computer and use it in GitHub Desktop.
import sys
import os
def main():
usage = """
You should pass at least 1 argument to %s
Arguments are folders full path separated by space.
""" % sys.argv[0]
argv = sys.argv[1:]
if not argv:
print(usage)
sys.exit(0)
output = []
for option in argv:
exist = "folder doesn't exist"
if os.path.exists(option):
exist = "folder exist"
output.append([option, exist])
for i, (folder, exist) in enumerate(output):
print("%r. %s\t [%s]" % (i + 1, folder, exist))
if __name__ == '__main__':
main()
>python check-folders.py c:\temp\1\ c:\temp\2\ c:\temp\2\file.txt
1. c:\temp\1\ [folder doesn't exist]
2. c:\temp\2\ [folder doesn't exist]
3. c:\temp\2\file.txt [folder doesn't exist]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment