Last active
January 1, 2016 04:08
-
-
Save guziy/8089608 to your computer and use it in GitHub Desktop.
Automate folder creation for different processes
This file contains hidden or 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 os | |
import sys | |
""" | |
Author: Huziy | |
Purpose: Automate folder creation for different processes | |
""" | |
def main(): | |
args = sys.argv | |
if len(args) < 2: | |
raise Exception("specify number of processes: python {0} {1}".format(args[0], "nprocs")) | |
try: | |
nprocs = int(args[1]) | |
except Exception: | |
raise ValueError( "The number of processes should be integer") | |
for i in range(1, nprocs + 1): | |
name = "{0:05d}".format(i) | |
if not os.path.isdir(name): | |
os.mkdir(name) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment