您的位置:首页 > 其它

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

2010-06-01 17:32 633 查看
有时候下载一个压缩文件,解压缩后却无法删除这个解压缩的文件夹,

原因是文件名称过长。我就碰到过,例如在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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐