Program to delete all the zip files present in destination

 Code to delete all the 'Zip' Files present in destination.

This code will help you to remove any files from the drive not just zip file. You will have to do little modification in the piece of code as per your requirement.

Before

After

Code
#Program to delete zip files present in destination

import os

destination = 'F:/remove'

def remove_zip_files(destination):
for filename in os.listdir(destination):
if filename.endswith('.zip'):
print('Unlinking File'+filename)
rem = destination+'/'+filename
print(rem)
os.unlink(rem)
else:
print('No Zip files found')

remove_zip_files(destination)

__author__ = "HEMANT KUMAR"

Share your valuable comments.






Comments

Popular posts from this blog

Python GUI Classic Example using KivyMD and Kivy (ScreenManager, position, MD, Images, Carousel etc.)

Download Application to convert Image to Pdf (Simple to Use)

Tkinter version of Python code for Image conversion into PDF.