If you’ve run into a problem deleting a file that Windows complains is “too long”, there is a dead simple solution built right into Windows—no extra apps, hacks, or work around required.
What’s the Deal with “Too Long” Names?
We’ve talked about this in greater detail before, but here’s the gist: Windows uses a naming convention called “Long Filenames (LFN)”. The LFN system supports file names up to 255 characters. Other operating systems, however, do not have similar restrictions. So if some Mac or Linux user were to archive a bunch of files with longer names and send you the archive, extracting that archive would leave you with files that exceed Windows’ character length. If you try to delete one of them, Windows will report that the name of the file is too long and it cannot delete it.
There’s a variety of ways you can deal with this problem (like downloading the free 7-Zip file compression tool, whose built-in file manager doesn’t complain about file name length), but rather than resort to extra software or third-party workarounds, we can leverage an old Windows trick to make short work of the files.
If you’re having trouble with long file path names, rather than long file names, you can make a small tweak in Windows 10 that enables longer file paths, too.
The Simplest Way to Delete Long Files
Before the Long Filename system there was the filename system in DOS, now known as the 8.3 Filename system (on account of the filenames being limited to 8 characters with a 3 character extension). Windows is famed for being backwards compatible, and this is a perfect example of where that backwards compatibility is extremely useful. Decades after DOS was a major operating system, we can still call up the DOS filenames for files on our modern Windows computers and, unlike the too-long-file-names that upset it, Windows won’t complain a bit when working with those short file names (even though they point at the same exact files that caused the problem in the first place).
In order to delete a too-long-file, all you need to do is open a command prompt in the directory where the file is located and use a simple command to get the short file name. Open File Explorer and navigate to the directory where your files are located. Press and hold Shift, then right-click on an empty area. Choose “Open command window here”. A Command Prompt window will open, focused on the directory you’re in.
Then, enter the following command in the Command Prompt window:
If the directory contains more files than can be displayed on a single screen, use the command
DIR /X /P instead, so that it will pause at every screen length so you can examine the file list.
This command will list all the directories and files in the current directory, and it will also list the old 8.3 filename for all the files and directories. In our example screenshot above, you can see how the dummy txt file with nonsensical (and hundreds of characters long) filename is reduced to a simple “WHYSOL~1.TXT”.
Armed with the short name of the file or directory you wish to delete, you can simply issue a DEL command for the file:
WHYSOL~1.TXT with the name of the file you want to delete.
Windows will delete the file without complaint (you can run
DIR /X again to confirm or just check the directory in Window Explorer). That’s all there is to it! With a clever use of a very old command, you can delete any file regardless of how long the file name is.
- › Get PC Power With Tablet Portability in the Surface Pro 9 for $200 Off
- › How to Change Your Age on TikTok
- › This Huge Curved Ultrawide Monitor From LG Is $337 Today
- › PSA: You Can Email Books and Documents to Your Kindle
- › The New HP Pro x360 Fortis Is a 2-In-1 Laptop Under $500
- › How to Screen Record on iPhone