Skip to content

Instantly share code, notes, and snippets.

@Mdslino
Created March 7, 2017 13:57
Show Gist options
  • Save Mdslino/b7673a1f20ae9e386feaac6875f863a7 to your computer and use it in GitHub Desktop.
Save Mdslino/b7673a1f20ae9e386feaac6875f863a7 to your computer and use it in GitHub Desktop.
Delete every torrent file in folder.
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