Python 3 Glob Library Script to Delete all Files and Folders Inside a Directory or Folder

Thanks for reading my article first. Python 3 Glob Library Script to Delete all Files and Folders Inside a Directory or Folder We are going to learn more about this in this article. Let’s go into the article

Python 3 Glob Library Script to Delete all Files and Folders Inside a Directory or Folder

Python 3 Glob Library Script to Delete all Files and Folders Inside a Directory or Folder

import os
import glob

files = glob.glob('uploads/*')
for f in files:
    os.remove(f)

Read Also: Python 3 Matplotlib Library to Generate Random Color Hexadecimal Codes and Plot in Graph Using Random

Final Words

Python 3 Glob Library Script to Delete all Files and Folders Inside a Directory or Folder We hope this article solves all your doubts. If in doubt let me know.

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment