Python Tutorials
Create Folders with Custom Name with Python
Hello Guys,
In this Python Tutorial, We are going to learn how to create a folder inside some folder with a Name You Want with the help of Python.
With No Delay Let’s Get Started.
First Create Python File Somewhere in your Laptop.
Now Open the Python file in Editor Mode. Start writing this code
import os
directory = input("Enter a Folder Name to Create --> ")
parent_dir = "C:\\Users\\Ramesh Naidu\\Desktop\\Code World\\Python Tutorials"
path = os.path.join(parent_dir, directory)
os.makedirs(path)
print("Directory '% s' created" % directory)
Here there is no need change directory, because it always asks you the name to the Folder you want to Create.
Note: Change parent_dir path to your own.
That’s it Now you can Create a Folder with a Custom name just at One Click.