Link to home
Start Free TrialLog in
Avatar of davebo4503
davebo4503

asked on

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
Avatar of serialband
serialband
Flag of Ukraine image

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
ASKER CERTIFIED SOLUTION
Avatar of Alan
Alan
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davebo4503
davebo4503

ASKER

Thanks Alan!