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

我有一个名为“prn”的文件夹,通过云同步服务在Windows上创build。

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

该名称可能与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资源pipe理器抛出…

 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 

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

我也试过在停止打印后台处理程序后删除 – 同样的错误。

任何任何想法?

谢谢

运行“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') 

然后删除diretory:

 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