简体   繁体   中英

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

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

Solved by running this command in cmd:

del *.bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM