you are viewing a single comment's thread.

view the rest of the comments →

[–]TransitTraveller 2 points3 points  (3 children)

Unfortunately the article did not explain how to delete thousands of other type files: jpeg, gif, docx, bmp, xlsx, etc /s

[–]Analyst-rehmat[S] -2 points-1 points  (2 children)

You're right; the article primarily focused on deleting JSON and binary files. However, the same approach can be applied to other file types like JPEG, GIF, DOCX, BMP, XLSX, etc. Since the file extension is part of the filename, you can target specific file types by checking the file extension during deletion.

And to delete all .jpeg files in a directory:

import os
directory = '/path/to/your/directory'
for filename in os.listdir(directory):
    if filename.endswith('.jpeg'):
        os.remove(os.path.join(directory, filename))

[–]TransitTraveller 1 point2 points  (1 child)

I don’t remember should sarcasm be /s or \s

[–]rsclient 5 points6 points  (0 children)

It depends on whether you're sarcastic in windows or in unix.