- 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 are entire non-empty directory trees removed using Python?
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')
If you want to remove an empty folder, you can call the rmdir function in os module. For example,
>>> import os >>> os.rmdir('my_folder')
- First Non-Empty String in list in Python
- What are Parse Trees (Derivation Trees)?
- How to rename directory using Python?
- How to Copy the entire contents of a directory in C#?
- How to create a directory using Python?
- How to change current directory using Python?
- How to remove a directory using Python?
- Numbers that are Bitwise AND of At Least One Non-Empty Sub-Array using C++
- Program to find out if two expression trees are equivalent using Python
- 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 are decision trees used for classification?
- Python Program that filters out non-empty rows of a matrix