<reponame>lacie-life/ProgrammingLanguageCollection<filename>Python/awesomeScripts/files_deletion/delete_srt.py<gh_stars>100-1000
# Delete all files ending with .*srt from 'mypath' and all of its subfolders
# Can be in use for any batch-deletion of similar-extension-files
import os
import re
import os.path

pattern = ".*srt"
mypath = "/Volumes/MyPassport/Courses/"

for root, dirs, files in os.walk(mypath):
    for file in filter(lambda x: re.match(pattern, x), files):
        os.remove(os.path.join(root, file))

# Delete all files ending with .*srt from 'mypath' and all of its subfolders
# Can be in use for any batch-deletion of similar-extension-files
import os
import re
import os.path

pattern = ".*srt"
mypath = "/Volumes/MyPassport/Courses/"

for root, dirs, files in os.walk(mypath):
    for file in filter(lambda x: re.match(pattern, x), files):
        os.remove(os.path.join(root, file))
# Delete all files ending with .*srt from 'mypath' and all of its subfolders # Can be in use for any batch-deletion of similar-extension-files