Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何删除文件夹而不是文件夹中的文件cmd?
cmd
比如,有一个目录:
c:\image\1.png c:\image\2.png c:\image\3.png c:\image\*.png c:\image\folder1\*.png c:\image\folder2\*.png ....
现在我不知道如何删除所有文件夹(和子文件)folder1,... ” ,folder2只保留文件1.png,,,,2.png...3.png4.png
folder1
folder2
1.png
2.png
3.png
4.png
for /d %F in (c:\image\*) do rd /s /q "%F"
如果在批处理文件中使用,则将百分比加倍