Last active
August 29, 2015 14:13
-
-
Save poliarush/091ce38c10245145ddbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>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