Solved

Filename too long - unable to delete file

Posted on 2002-07-21
9
10,211 Views
Last Modified: 2012-05-04
Hello,

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
0
Comment
Question by:Selcon
9 Comments
 
LVL 44

Accepted Solution

by:
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
0
 
LVL 22

Expert Comment

by:cookre
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.
0
 
LVL 22

Expert Comment

by:cookre
ID: 7168421
Gotta love cross posts.
0
 
LVL 22

Expert Comment

by:cookre
ID: 7168422
PS: Shows you how much I know, I didn't think XP had short names
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 44

Expert Comment

by:CrazyOne
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.
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7168490
Selcon
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.
0
 
LVL 7

Expert Comment

by:jmiller47
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.
0
 

Author Comment

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

Expert Comment

by:CrazyOne
ID: 7168618
You are welcome. :>)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
If you build your web application in Visual Studio you'll get at least a few binaries, or .DLL, files in your bin folder. However, there is more compiling to be done. Normally this would happen when an ASP.NET resource within the web site is request…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now