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.

KSR

Hi there! I am the Founder of Cyber World Technologies. My skills include Android, Firebase, Python, PHP, and a lot more. If you have a project that you'd like me to work on, please let me know: contact@cyberworldtechnologies.co.in

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button