6

We have a hidden file with a space at the end of the file name. Usually, I take ownership of the file, then use a command line rename with the 8.3 (dir/x) file name. However, rename doesn't acknowledge hidden or system files.

Any ideas on how to remove it? The original creator cannot access the file. The system is a Windows 2003 server with NTFS and SMB file sharing (normal windows file sharing).

Zachary Scott
  • 227
  • 2
  • 14

4 Answers4

5

In the command prompt, you can put the name of the file in quotes (including the space). For example:

del "failfile.txt "

In Windows Explorer, you can go to Tools | Folder Options, click the View tab, and select "Show hidden files and folders." Then click OK and you'll see the file, and will be able to select and delete or rename it.

blueadept
  • 516
  • 2
  • 6
  • It shows the file in the list, although the icon is ghosted white. If you right click the file, it doesn't show a security tab at all. If you right click to rename it, it gives some odd error about the file needing a name. However, I ended up doing a del /s /a to the folder above it with success, which is pretty much what you listed. Apparently delete allows you to do this where rename and attrib won't work with that file name. Crazy – Zachary Scott May 04 '10 at 19:51
  • You might test the Del "Failfile.txt ". – RobW Feb 09 '11 at 19:03
5

It's a while since this questions was asked, but I had the same problem and a simple delete on the command line did not work for.

I had to use the shortened DOS file name to get rid of such an undeletable file. With dir /X you will get the shortened file names. Then use this name for the delete command: del failfi~1.txt.

Marko
  • 227
  • 4
  • 7
  • 15
Kai K.
  • 157
  • 1
  • 4
2

write

\\?\

Before Absolute Path of file with the space at end.

del "\\?\D:\MyPath\MyFile " /S

Read more here:

Click here for: Very good information page about Windows command DEL

PatxiRB
  • 121
  • 2
1

Try del filename? or remove the hidden attribute first with attrib -h filename? followed by a del filename.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109