Filename too long - unable to delete file

Posted on 2002-07-21
Last Modified: 2012-05-04

Recently I downloaded a few .mpg files through KaZaa, when i tried to open them, windows media player opened up a webpage instead. When i then tried to delete them by clicking on the filename and pressing Delete, nothing happens.
I checked the filename and it seems like the filename is extremely long and it is disguised to be short. It goes like "abc.mpg                 fgf sfgsfd fdsg.mpg" -- notice the tons of spaces in the filename.
I tried to delete the file in Command Prompt and got a "The filename or extension is too long" error.

Can anyone tell me how to handle such files? Thanks
Question by:Selcon
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 44

Accepted Solution

CrazyOne earned 100 total points
ID: 7168413
Ok open the Command Prompt window. Now move to the folder where these file are by using the CD command Example:
CD c:\TheFolder
Now run this command
dir /x
This will give a list of the short file names like abcdefg~.mpg. And then delete the file using the short file name.

The Crazy One
LVL 22

Expert Comment

ID: 7168419
It's unlikely the file name alone is too long, just that in conjunction with the full path the result is too long.

From DOS, CD to the directory and try a del abc.mpg*.mpg
If there are other files that may match that mask, move them to some other directory first.
LVL 22

Expert Comment

ID: 7168421
Gotta love cross posts.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 22

Expert Comment

ID: 7168422
PS: Shows you how much I know, I didn't think XP had short names
LVL 44

Expert Comment

ID: 7168487
Actually what I suspect is happening is that the file name has some characters that are invalid to Explorer and these characters look like spaces sometimes. Hackers love to do this especially when they find a machine they can break into. They will create folders with invalid characters making the deletion of the folders a not so easy task. They are hoping the mahcine they hacked that the user isn't aware the short file name trick.
LVL 44

Expert Comment

ID: 7168490
Did you try to rename the files. Right click on the file and select Rename and see if it allows you to rename the file. If not then the file name does have invalid characters in it that Explorer just doesn't know how to deal with.

Expert Comment

ID: 7168508
Exactly. I just had a client who couldn't delete some files because of some bogus error and the problem was that someone (the last administrator) actually (somehow) created the filenames with characters that could not be used in a filename or directory name. I think it was an apostrophe but I'm not sure. I would try renaming the file. If that doesn't work, rename the directory beneath it that possibly has a strange character if one exists.

Author Comment

ID: 7168612
Yep, that worked! thanks =)
I tried renaming the file to a shorter name, but win xp just doesnt let me.
LVL 44

Expert Comment

ID: 7168618
You are welcome. :>)

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question