删除Windows文件名过长的文件或者目录

 

有时候下载一个压缩文件,解压缩后却无法删除这个解压缩的文件夹,

原因是文件名称过长。我就碰到过,例如在eclipse的一些版本的IDE,由于

java的命名的特性,文件名称过长,既无法重命名,无法复制,也无法删除。

 

具体有两种解决办法:

 

A. 进入windows命令行,到达文件所在目录,通过如下命令删除文件或者目录。

 

DIR /X

RMDIR /S  文件名或者目录

 

顺便学习下WINDOWS的基本命令行

----------------------------------------------------------------------------------------------------------------------------------------------------

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]Specifies drive, directory, and/or files to list.
attributes
D Directories R Read-only files H Hidden files A Files ready for archiving S System files - Prefix meaning not
/BUses bare format (no heading information or summary).
/CDisplay the thousand separator in file sizes. This is the default. Use /-C to disable display of separator.
/DSame as wide but files are list sorted by column.
/LUses lowercase.
/NNew long list format where filenames are on the far right.
/OList by files in sorted order.
sortorder
N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date/time (oldest first) G Group directories first - Prefix to reverse order
/PPauses after each screenful of information.
/QDisplay the owner of the file.
/SDisplays files in specified directory and all subdirectories.
/TControls which time field displayed or used for sorting
timefieldC Creation
A Last Access
W Last Written
/WUses wide list format.
/XThis displays the short names generated for non-8dot3 file names. The format is that of /N with the short name inserted before the long name. If no short name is present, blanks are displayed in its place.
/4Displays four-digit years

 

 

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S.

 

B. 建立一个del.bat 文件,其内容如下:

 

"DEL /F /A /Q //?/%1
RD /S /Q //?/%1"

 

------------------------------------------------------------------------------------------------------------------------------------------------------------

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

namesSpecifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted.
/PPrompts for confirmation before deleting each file.
/FForce deleting of read-only files.
/SDelete specified files from all subdirectories.
/QQuiet mode, do not ask if ok to delete on global wildcard
/ASelects files to delete based on attributes
attributes
R Read-only files S System files H Hidden files A Files ready for archiving - Prefix meaning not

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值