简体   繁体   English

批处理-删除文件夹和所有文件

[英]Batch - Delete folder and all files

I have a folder full of invalid files. 我有一个充满无效文件的文件夹。 The properties says the folder is 1.28TB, but my flash drive is only 8GB. 属性显示该文件夹为1.28TB,但我的闪存驱动器仅为8GB。 I can't delete the files so I tried a batch file, but it didn't work. 我无法删除文件,所以尝试了一个批处理文件,但是没有用。 I'm not sure if my batch was wrong or what. 我不确定我的批次是否有错或什么。

I tried two files I found on this site: 我尝试了在此站点上找到的两个文件:

cd "I:\Java\Workspace\GridWorld1\.metadata\.plugins\org.eclipse.core.resources\.projects\.org.eclipse.jdt.core.external.folders"
del *.
pause

and

set folder="C:\test"
cd /d I:\Java\Workspace\GridWorld1\.metadata\.plugins\org.eclipse.core.resources\.projects\.org.eclipse.jdt.core.external.folders
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
pause

The second batch ran tons of lines and the final line was: 第二批运行了几条生产线,最后一条生产线是:

I:\Java\Workspace\GridWorld1\.metadata\.plugins\org.eclipse.core.r
ects\.org.eclipse.jdt.core.external.folders>(rmdir "er.Bundl.eLo"
"er.Bundl.eLo" /s/q )
The system cannot find the file specified.
The filename, directory name, or volume label syntax is incorrect.

I have almost no experience with batch files, but I have no idea how to delete these files. 我几乎没有批处理文件的经验,但是我不知道如何删除这些文件。 Here is link to a picture of the invalid files. 这是无效文件图片的链接。 Invalid File Picture 无效的文件图片

If the properties state that the folder contains 1.28T and it's only an 8G stick, there's almost certainly corruption on the file system. 如果属性表明该文件夹包含1.28T且仅是8G棒,则几乎可以肯定文件系统上有损坏。 It's incredibly unlikely that a batch file will be able to achieve something that you can't do with direct commands since it is, after all, just a way to perform those direct commands from a script. 批处理文件不可能实现直接命令无法实现的功能,因为毕竟这只是从脚本执行那些直接命令的一种方式。

My advice would be to copy everything except the dodgy folder onto other media, format the stick (full format, not quick, just to be sure), then copy the saved files back. 我的建议是将 dodgy文件夹以外的所有内容都复制到其他介质上,格式化存储棒(完全确定,不是很快,只是为了确定),然后再复制保存的文件。

That way, you keep everything except the stuff you're willing to delete anyway, and you can be reasonably certain the file system is consistent. 这样,您可以保留除了愿意删除的内容以外的所有内容,并且可以合理地确定文件系统是一致的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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