Share via

Can't delete NUL file. (solved)

Anonymous
2014-06-05T04:43:22+00:00

Still running Windows XP Pro SP3 (because my old CAD software doesn't want to play nice with Win7 or Win8.1). Cannot delete a file named "NUL" (without the quotes). It is in a subdirectory which I was able to rename and move to the root of the drive, but the file in that subdirectory simply can't be deleted. I tried encrypting the file and get "Error Applying Attributes" E:\junk\NUL  The parameter is incorrect. Doing "dir /x" simply lists the file as NUL (so no hidden characters). Can't rename the file, "ren NUL something" returns "Parameter is incorrect". Can't do anything from Windows Explorer, just error messages whenever I try to delete the file or the directory. From a command window get:

E:\junk>dir

 Volume in drive E is New Volume

 Volume Serial Number is 8C04-1400

 Directory of E:\junk

06/03/2014  01:09 PM    <DIR>          .

06/03/2014  01:09 PM    <DIR>          ..

11/04/2013  03:17 PM                29 NUL

               1 File(s)             29 bytes

               2 Dir(s)  35,894,820,864 bytes free

E:\junk>type NUL

E:\junk>        

(So the file appears to actually be empty and not 29 bytes long)

(Editing the file with Notepad++ and viewing in hex mode shows no data, not even 0x00 bytes so Notepad++ thinks it's an empty file)

E:&gt;rd junk /s/q

junk\NUL - The parameter is incorrect.

E:\junk>attrib *

A          E:\junk\NUL

E:\junk>del NUL

The filename, directory name, or volume label syntax is incorrect.

Putting NUL in quotes gives the same error.

Running the sysInternals ProcessExplorer.exe program and searching for a process that has the NUL file locked turns up nothing. Booting up in safe mode and I still can't delete the file.

After keying in the above it occurred to me to try cygwin. Low and behold doing the following:

$ cd /cydrive/e/junk

$ rm -f NUL

and the file is gone! Many thanks to the cygwin team!

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. LemP 74,925 Reputation points Volunteer Moderator
    2014-06-05T05:43:59+00:00

    You found the way.

    The problem was that "NUL" is a Windows reserved name.  See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx which includes the following:

    • Do not use the following reserved names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see *Namespaces*.
    • Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

    The method you used is similar to one discussed here --> http://support.microsoft.com/kb/120716

    0 comments No comments