Created
March 7, 2017 13:57
-
-
Save Mdslino/b7673a1f20ae9e386feaac6875f863a7 to your computer and use it in GitHub Desktop.
Delete every torrent file in folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os.path import join | |
import os | |
def apagar_torrent(): | |
"""Find and delete every .torrent find in the directory""" | |
folder = "/home/marcelo/Downloads/" | |
test = os.listdir(folder) | |
for item in test: | |
if item.endswith(".torrent"): | |
print("Arquivo encontrado") | |
print("Deletando arquivo %s" %item) | |
os.remove(join(folder, item)) | |
def main(): | |
"""Main function""" | |
apagar_torrent() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment