Windows 7. Unable to remove a directory called 'prn'

1

I have a folder named 'prn' that was created on Windows via a cloud sync service.

I'm no longer a subscriber to the service and have tried to remove the folder.

The name is probably clashing with a Windows reserved term, I guess for the print queue.

A command prompt denies the directory is there

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 Explorer throws...

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 

Searching for help on this error message mainly gives advice on Task scheduler, some issues with Windows Updates and Outlook address books.

I've also tried removing after stopping the Print Spooler service - same error.

Anyone any ideas?

Thanks

windows
file
shell
asked on Stack Overflow Sep 26, 2013 by Cuchulain

1 Answer

1

Run "python", then at the prompt type:

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

(The \\?\ is Windows magic to tell it not to treat "prn" specially. You must use an absolute path.)

That should print a list of files in that directory. So delete them:

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

Then delete the diretory:

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

The above instructions should work with Python 2.x or 3.3+.

(You can also use any programming language you're familiar with, so long as it calls the Unicode versions of the Win32 API calls).

EDITED TO ADD: Or try:

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

os.rename(old, new)

(If using python 3, omit the u before the strings)

answered on Stack Overflow Sep 26, 2013 by user9876 • edited Sep 26, 2013 by user9876

User contributions licensed under CC BY-SA 3.0