Can’t Delete Files With Long Filenames? Fix It In Just 5 Seconds

Saikat Basu 18-01-2017

“Please help. I can’t delete a file due to the filename being too long.”


This one is a perplexing problem that can be solved in five seconds, and all it takes is a simple DOS command from the past. But first, let’s get introduced to one of the oldest errors that Windows throws up and the culprit behind them: Long Filenames (LFN).

What Are Long Filenames?

Long Filenames are inherited from Windows 95 and its MS-DOS architecture. The LFN system specified file and directory names of up to 255 characters. This was a change from the older 8.3 file naming convention of a maximum eight characters (after any directory path), followed optionally by a filename extension consisting of a period [.] and at most three more characters.

As Windows is backwards compatible, we will use this “interconversion” between the two file naming systems to solve our problem, because sometimes filenames will exceed the limits set for them.

Many Windows programs expect the maximum path length to be shorter than 255 characters. This limit excludes the file path under which it is located. But, when you copy a file from one location, it takes into account the entire file path.

Long File Name


Files with too long filenames can be a product of other operating systems. It can also be born as a cache file from a third-party software. Or, it can be a media file with a really long name. Sometimes, these files are also created if they exist in deeper directories like a network share.

You can manage such files with the software that created them. But if that fails, here’s a much easier solution.

Solving “Too Long” Filename Errors

It is a simple three-step process to delete a file with a long filename. The trick is to auto-generate a shorter filename and use that.

  1. Open a command prompt in the directory where the file is located.
  2. Use a DOS command to get the short filename in the 8.3 filename format.
  3. Now, use the DEL command in DOS for the file to delete the file.

Let’s see how it works with an example. Here we have a file with a long filename in a directory.

Open File Explorer and browse to the file in its directory. Press Shift and then right-click on an empty area. Choose Open command window here. A Command Prompt window will open with the path set to the directory you’re in.

Open Command Prompt

Enter the DOS command for listing the files and folders in the current directory. The dir command is an internal command and is available on all Microsoft operating systems. The /X attribute displays the short names for non-8.3 filenames. You can also use DIR /X /P to pause and move from one screen to the next when there are too many files to examine.

The screenshot below shows you the text file we want to delete with the “modified” short filename.

Can’t Delete Files With Long Filenames? Fix It In Just 5 Seconds Short File Name

So, you can see how we used DOS to “auto-generate” a shorter name for the file. Now, just use the simple DEL command on the short filename to remove the file. That’s it!

Can’t Delete Files With Long Filenames? Fix It In Just 5 Seconds Delete

The lesson here is to not neglect DOS. There are a variety of useful DOS commands that can still save your day. While you’re memorizing those, you’ll also want to learn how to fix another common Windows problem: files that are locked for editing and deletion How to Delete a File in Use by Another Program Windows says your file is in use because it's open in another program? We show you how to force rename, delete, or move the file. Read More .

Image Credit: hanss via

Explore more about: File Management, MS-DOS, Troubleshooting, Windows 10.

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Valdemar Bago
    May 27, 2020 at 11:29 pm

    I would highly recommend to try LongPathTool. It is really helpful.

  2. Eniela
    May 18, 2020 at 2:50 pm

    I use LongPathTool and it has literally saved my life.

  3. Kevin Nelson
    May 13, 2020 at 3:20 pm

    Use LongPathTool. It's best software

  4. James Lee
    January 5, 2020 at 6:06 am

    Long Path Tool will let you easily delete, copy or rename long path files.

  5. Garry Gahan
    October 8, 2018 at 5:02 pm

    I suggest you Long Path Tool will let you easily delete, copy or rename long path files, you can try it for better service.

  6. Peter Adamson
    October 8, 2018 at 3:52 pm

    I suggest you try Long path tool is the very good program for easily delete, copy & rename long path files, error, unlock solution.
    Try it and solve your problem.
    I used long path tool and I solve my error, unlock problem solution.

  7. L.D. Byhnatosa
    September 28, 2018 at 1:24 pm

    it is very very easy...just rename all the folder which contain long name file,then that long name file also be rename..then hit delete....u'r welcome

  8. Brandon Wooten
    August 6, 2018 at 3:43 am

    Have you tried 'long path tool'?
    it's very helpful for me.

  9. daddyevil
    April 24, 2018 at 8:53 pm

    That's as clear as mud!
    Hopefully, someone who commented here has a workable solution!

  10. Andrej Kokunesoski
    April 5, 2018 at 9:27 am

    just turn it into zip or winrar file and you can delete it

  11. George Renee
    March 12, 2018 at 4:28 am

    Use GS RichCopy 360 and change the directory location with smaller directory names – that way you’ll be able to fix this problem. Most other tools that you work with cannot copy files with long path names.

  12. Fred Greenstein
    January 13, 2018 at 7:08 am

    Long Path Tool will let you easily delete, copy or rename long path files.

  13. Baretto James
    December 10, 2017 at 6:39 pm

    Well..well..well.. someone provided a long-cut solution. Can you do this thing if there are too many files to delete? Of course not. I used GS Richcopy 360 to solve this error. Helped me a lot. And I am done with this error. All thanks to GS 360. What else can a customer like me want!

  14. Hillery
    November 20, 2017 at 1:17 pm

    Hi I've been using Long path tool for this problem . Try it :)

  15. Hillery
    November 20, 2017 at 1:13 pm

    Loong path tool was always there for me in this type of problem. I've been using it for months now and it is really helpful

  16. Corey Lean
    August 21, 2017 at 2:23 pm

    Consider a situation where I have to transfer 700 GB of data and many at times I am getting this error, so what do you expect me to do? Opening DOS windows again and again to solve this problem for each file. That's not feasible. Once I had this error, I tried GS Richcopy 360 and it helped me to solve this problem. No missing files encountered again, no errors again. Simple life!

  17. EricClarks
    August 19, 2017 at 10:59 am

    Try to use Long Path Tool, it really can help you with that.

  18. sullivan4
    August 15, 2017 at 12:24 pm

    Files with long name create many problems,To solve this problem use "LongPathTool".I was facing problem with files having long mane.It exactly help me and i get ride from file long path problem.

  19. Ashley100
    June 21, 2017 at 9:34 pm

    Exactly, I came to face this issue also. Then some recommended me Long Path Tool software and I am grateful to that person.

  20. morgancooper
    May 7, 2017 at 10:54 am

    Long PathTool is a software that will let you easily delete, copy or rename long path files.

  21. cris
    January 18, 2017 at 9:28 am

    this just shows that DOS is still useful until now.

    • Saikat Basu
      January 22, 2017 at 6:10 am

      Very much so. I think it is one of the "geek" skills everyone should learn a little.