Skip to content

Instantly share code, notes, and snippets.

@alaztetik
Created December 4, 2021 11:33
Show Gist options
  • Save alaztetik/121e1679e5ec6e4b41a3178c4951473d to your computer and use it in GitHub Desktop.
Save alaztetik/121e1679e5ec6e4b41a3178c4951473d to your computer and use it in GitHub Desktop.
Creates folders with fixed prefix and incremental numbers at the end
import os
def create_folders(num, prefix=''):
"""Creates specified numbers of folders with a prefix in front of each"""
for num in range(1, num+1):
if not os.path.exists(f"{prefix}{str(num)}"):
os.makedirs(f"{prefix}{str(num)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment