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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:52:39  来源:igfitidea点击:

How to delete "The file name is too long." in windows. [Command Prompt]

windowscommand-promptdelete-filerobocopy

提问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 robocopyand rmdir.

删除文件名太长。错误文件,我们必须使用 Windowsrobocopyrmdir.

  1. Create directory mkdir deleteLongFilesDirunder C:or D:drive
  2. Suppose D:\Development\Liferay\themesdirectory contains the files which are not able to delete simply.
  3. 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 of D:\Development\Liferay\themesinto deleteLongFilesDirfolder virtually, but when you open that directory... hurreeee...It's Empty ???
  4. Now run the command of remove directory which we created for mapping rmdir deleteLongFilesDirfrom command line.
  5. Now temporary directory has been deleted and same as for D:\Development\Liferay\themesfiles and folder.
  1. mkdir deleteLongFilesDirC:D:驱动下创建目录
  2. 假设D:\Development\Liferay\themes目录包含不能简单删除的文件。
  3. 在命令提示符下运行命令robocopy D:\deleteLongFilesDir D:\Development\Liferay\themes /purge,此命令将打印一些日志并将您的所有文件和子目录虚拟复制D:\Development\Liferay\themesdeleteLongFilesDir文件夹中,但是当您打开该目录时...... hurreeee......它是空的???
  4. 现在运行我们为rmdir deleteLongFilesDir从命令行映射而创建的删除目录的 命令。
  5. 现在临时目录已被删除,与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。