Home > Net >  I accidentally created a huge amount of files on my Desktop with Python. How do I get rid of them?
I accidentally created a huge amount of files on my Desktop with Python. How do I get rid of them?

Time:11-28

Hello so I accidentally run a python program which is very dangerous what I made. A create a loop and created millions of files on my Desktop with it. Damn what have I done! I cant even use my desktop now. screenshot: https://ibb.co/kq3VThv. Please do you know how do I fix this? The code was:

import os


desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')

i = 1

while True:
    new_folder = 'Test' str(i)
    folder_path = os.path.join(desktop, new_folder)
    with open(f"{folder_path}.bin",mode="a") as f:
       f.write("")
       f.close()
    i  = 1

CodePudding user response:

Solved by running this command in cmd:

del *.bin

  • Related