- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to delete a Python directory effectively?
If you want to remove an empty folder, you can call the rmdir function in os module.
>>> import os >>> os.rmdir('my_folder')
If you want to delete a folder containing all files you want to remove, you can remove the folder as follows −
>>> import shutil >>> shutil.rmtree('my_folder')
- How to delete multiple files in a directory in Python?
- How to delete all files in a directory with Python?
- Delete a directory in Java
- Java Program to delete file or directory
- Using Iterations in Python Effectively
- How to create a directory using Python?
- How to remove a directory using Python?
- How to disable delete permission of File and Directory in Linux?
- Delete the file or directory in Java
- How to create a directory recursively using Python?
- How to remove a directory recursively using Python?
- How to calculate a directory size using Python?
- How to check if a given directory contains any other directory in Python?
- How to delete a file using Python?
- How to effectively hide Href From a Link in PHP?