Windows 7.无法删除名为“prn”的目录

时间:2013-09-26 09:15:03

标签: windows file shell

我有一个名为'prn'的文件夹,它是通过云同步服务在Windows上创建的。

我不再是该服务的订阅者,并试图删除该文件夹。

该名称可能与Windows保留术语发生冲突,我想是打印队列。

命令提示符拒绝该目录存在

E:\goDropBox\Dropbox>dir prn

 Directory of \\.

File Not Found

E:\goDropBox\Dropbox>cd prn
The system cannot find the path specified.

E:\goDropBox\Dropbox>del prn
The filename, directory name, or volume label syntax is incorrect.

E:\goDropBox\Dropbox>

Windows资源管理器抛出...

An unexpected error is keeping you from deleting the folder. If you continue to receive this error, you can use this error code to search for help with this problem.

 Error 0x8007010B: The directory name is invalid

  prn
  Date created: 03/07/2013 

搜索有关此错误消息的帮助主要提供有关任务计划程序的建议,以及Windows更新和Outlook通讯簿的一些问题。

我也尝试在停止Print Spooler服务后删除 - 同样的错误。

任何想法?

由于

1 个答案:

答案 0 :(得分:1)

运行“python”,然后在提示符下键入:

import os
os.listdir(ur'\\?\E:\goDropBox\Dropbox\prn')

\\?\是Windows魔术告诉它不要特别对待“prn”。你必须使用绝对路径。)

那应该打印该目录中的文件列表。所以删除它们:

os.unlink(ur'\\?\E:\goDropBox\Dropbox\prn\file1')
os.unlink(ur'\\?\E:\goDropBox\Dropbox\prn\file2')

然后删除指南:

os.rmdir(ur'\\?\E:\goDropBox\Dropbox\prn')

以上说明适用于Python 2.x或3.3 +。

(您也可以使用您熟悉的任何编程语言,只要它调用Win32 API调用的 Unicode 版本)。

已编辑添加: 或者尝试:

old = u"\\\\?\\E:\\goDropbox\\Dropbox\\prn"
new = u"\\\\?\\E:\\goDropbox\\Dropbox\\foo"

os.rename(old, new)

(如果使用python 3,则省略字符串前的u