Skip to content Skip to sidebar Skip to footer

Create New Folders Within Multiple Existing Folders With Python

I am looking for a way to create new folders within multiple existing folders. For example I have folders a,b,c.. etc and I want to create a new folder inside each of these existin

Solution 1:

Try looping through your list of folders rather than passing in the list. It is not the cleanest method out there but you can do something like:

parents = [p1, p2, p3]
childern = [c1, c2, c3]

for p in parents:
   for c in children:
      os.mkdir(os.path.join(p,c))

Post a Comment for "Create New Folders Within Multiple Existing Folders With Python"