We help IT Professionals succeed at work.

can't delete file with long name - dir /X doesn't work

Can't delete file with long name on win server 2016.
dir /X doesn't show short file name even after using fsutil command to allow 8.3 name
Comment
Watch Question

The simplest solution is to Mount it on a linux, unix or osx system and move or delete it that way.  You won't see the short name nowadays, unless it was already turned on and allowed to be created at the same time.  Windows turned that portion off but still hasn't allowed explorer to access the very long filename.

Next.  if the long file name is partly due to a long directory path name, either shorten that name, move that folder down to the drive level, or make a directory juntction to it, then delete it.

Either one of these will work.
Move the deep linked directory to the drive root:
move C:\very\very\long\directory\path\to\the\file\name\you\wish\to\remove\ C:\r

Make a directory junction (hardlink) to the deep linked directory.
mklink /j c:\r  C:\very\very\long\directory\path\to\the\file\name\you\wish\to\remove

del c::\r\myverylongfilename.fil
Consultant
Commented:
Change the name of one or more of the higher level folders to reduce the overall path length, delete the file, then change the folder names back (if required).

Alan.

Author

Commented:
Thanks Alan!