Windows filename question

Posted by: tanstaafl.

Windows filename question - 08/09/2006 05:36

A bit of empirical testing shows me that the maximum filename length including full directory path in Windows XP seems to be 255 characters.

I have some very deeply nested files in my music directory. For example:

D:\_MP3\CLASSICAL\Composers A-B\Beethoven, Ludwig Van\Beethoven Sonatas for Piano\Beethoven Piano Sonata in C Minor\Beethoven, Ludwig van - Beethoven Piano Sonatas - 05 - Beethoven-Sonata in C Minor Op 111 1st Mvt. (Maestoso Allegro con brio ed appassionato).mp3

If you wanted to take the trouble, you would count that filename and path at 262 characters. While Windows won't allow one to create a filename that long, I believe that MP3 Tag Studio will. I am pretty sure that is how that filename came into being.

That file is in a directory with another similarly named file -- but the second filename (with directory path) is exactly 255 characters long.

Here is the problem:

Windows will let me play, change filename, delete, etc. the second file (the one tht is 255 characters long) but the first file (the 262 character file) I can do nothing with. Windows Media player will bring up the file, but it just sits there, doesn't play it. I can't rename the file, I can't delete the file, I can't do anything with the file except look at it in Windows Explorer. I can't do anything with it at a DOS prompt because of the spaces in the filename (I get invalid syntax error) and I don't know of any utilities currently in my computer that will work with it.

How can I re-name this file so Windows will work with it?

tanstaafl.
Posted by: mac

Re: Windows filename question - 08/09/2006 05:44

I believe that it's only FAT that is limited to 255 characters but many programs may have that limit too.

If you want to rename or move the file here's a trick I came across a few months ago:

At a command prompt enter something like:

subst x: d:\_MP3\CLASSICAL

You should then be able to access the file successfully through X: to do what you need to with it because the resulting path names will be less than 255 characters long.

You may also find that you can just move the file from the command line if you're sat in the directory.

Mike.
Posted by: elperepat

Re: Windows filename question - 08/09/2006 06:05

An other trick you can use is to rename temporarly one of the parent folder to shorten the whole path/name of the file to less than 255 characters. Then, you'll be able to rename the file. Once it's done, you can rename the parent folder to it's original name.
Posted by: Shonky

Re: Windows filename question - 08/09/2006 07:39

Another method is to use the Windows 8.3 versions of the file names i.e. something like

D:\_MP3\CLASSI~1\Compos~1\Beetho~1\Beetho~1\Beetho~1\Beethoven, Ludwig van - Beethoven Piano Sonatas - 05 - Beethoven-Sonata in C Minor Op 111 1st Mvt. (Maestoso Allegro con brio ed appassionato).mp3

You don't need to abbreviate everyone if you're only a few chars over. "dir /x" from a command prompt will give you the short versions since they won't always be ~1

Yes. Freakin' annoying. Programs will generally work if you are in the directory, but you can't access the full path. I have issues all the time on our server with this problem and my rsync backup.
Posted by: Roger

Re: Windows filename question - 08/09/2006 07:48

Quote:
I believe that it's only FAT that is limited to 255 characters but many programs may have that limit too.


We covered this one a while ago.

Most applications (including Windows Explorer) use _MAX_PATH for their path name buffers. It's defined as 260, which is enough room for the C:\ part, 256 letters and the terminating NULL.

Which is odd, because FAT -- IIRC, and as you say -- only supports 255-character filenames.
Posted by: furtive

Re: Windows filename question - 08/09/2006 09:26

You've got a whole load of redundancy in that path!

To fix it, open a command prompt and rename the "Beethoven, Ludwig Van" directory to a single character

That should make the path shorter so that you can rename the file to reduce its overall length.

I suggest:

D:\_MP3\CLASSICAL\Composers A-B\Beethoven, Ludwig Van\Sonatas for Piano\Piano Sonata in C Minor\05 - Op 111 1st Mvt.mp3

And use tags rather than file names on your MP3's
Posted by: larry818

Re: Windows filename question - 08/09/2006 19:15

I was thinking the same thing, "Beethoven" appears in the file name alone three times, and three times in the path.

I agree with furtive's naming convention, with the exception that I do like to have the artist information in the .mp3 file name as well.
Posted by: tanstaafl.

Re: Windows filename question - 08/09/2006 23:32

Quote:
rename temporarly one of the parent folder to shorten the whole path/name of the file


Doh!

Of course.

Thanks for pointing out how dumb I am!

tanstaafl.