Delete files with python through OS shell

前端 未结 4 410
时光取名叫无心
时光取名叫无心 2020-12-30 02:19

Im Tyring to Delete all Files in E:. with wildcard.

E:\\test\\*.txt

I would ask rather than test the os.walk. In windows.

4条回答
  •  一向
    一向 (楼主)
    2020-12-30 03:02

    You could use popen for this as well if you want to do it in fewer lines

    from subprocess import Popen
    proc = Popen("del E:\test\*.txt",shell=False)
    

提交回复
热议问题