windows 如何删除“文件名太长”。在窗户里。[命令提示符]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44081985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to delete "The file name is too long." in windows. [Command Prompt]
提问by Ashish Dadhich
How to delete large file path/file name files in Windows. Which is slimier to Linux rm -rf .?
如何在 Windows 中删除大文件路径/文件名文件。哪个比 Linux rm -rf 更苗条。?
回答by Ashish Dadhich
To delete The file name is too long.errors files, we've to go for simple steps using default command of Windows robocopy
and rmdir
.
删除文件名太长。错误文件,我们必须使用 Windowsrobocopy
和rmdir
.
- Create directory
mkdir deleteLongFilesDir
underC:
orD:
drive - Suppose
D:\Development\Liferay\themes
directory contains the files which are not able to delete simply. - run command in command prompt
robocopy D:\deleteLongFilesDir D:\Development\Liferay\themes /purge
, this command will print some logs and copy you all the files and sub directory ofD:\Development\Liferay\themes
intodeleteLongFilesDir
folder virtually, but when you open that directory... hurreeee...It's Empty ??? - Now run the command of remove directory which we created for mapping
rmdir deleteLongFilesDir
from command line. - Now temporary directory has been deleted and same as for
D:\Development\Liferay\themes
files and folder.
mkdir deleteLongFilesDir
在C:
或D:
驱动下创建目录- 假设
D:\Development\Liferay\themes
目录包含不能简单删除的文件。 - 在命令提示符下运行命令
robocopy D:\deleteLongFilesDir D:\Development\Liferay\themes /purge
,此命令将打印一些日志并将您的所有文件和子目录虚拟复制D:\Development\Liferay\themes
到deleteLongFilesDir
文件夹中,但是当您打开该目录时...... hurreeee......它是空的??? - 现在运行我们为
rmdir deleteLongFilesDir
从命令行映射而创建的删除目录的 命令。 - 现在临时目录已被删除,与
D:\Development\Liferay\themes
文件和文件夹相同。
回答by Luke
There is a Powershell cmdlet named Remove-Item2, written by Boe Prox a well-known MVP, and which circumvents the basic limitation path of 260 characters.
有一个名为Remove-Item2的 Powershell cmdlet ,由著名的 MVP Boe Prox 编写,它绕过了 260 个字符的基本限制路径。
https://gallery.technet.microsoft.com/scriptcenter/Remove-LongPathFile-7a4db495
https://gallery.technet.microsoft.com/scriptcenter/Remove-LongPathFile-7a4db495
Additionally, like Remove-Item2, there are other cmdlets suffixed by the number 2, like Get-ChildItem2, which are often included in popular third party modules, and also addresses the 260 characters limitation. If you have installed some of these modules, there is a chance that you have already those cmdlets on your computer.
此外,与Remove-Item2 一样,还有其他以数字 2 为后缀的 cmdlet,例如Get-ChildItem2,它们通常包含在流行的第三方模块中,并且还解决了 260 个字符的限制。如果您安装了其中一些模块,则您的计算机上可能已经安装了这些 cmdlet。