Jump to content

Cannot delete a file with a too long name


Recommended Posts

Guest horst
Posted

I found that I still have a "Sandboxie" folder although I had

uninstalled it.

So I decided to delete it but I got a message telling that it couldn't

delete a file because its name was too long.

Actually there is a a .htm file whose name is 111 characters long.

No way to rename, move or delete it.

I got the same error when I tried to delete it in the DOS window.

Any suggestion please?

Thanks

Horst

Guest Meinolf Weber
Posted

Re: Cannot delete a file with a too long name

 

Hello horst,

 

Try move it to another location where you have full access (c-drive for example

and delete it there). If this doesn't help, you can try with robocopy.exe

to move it to external drive and even if it seems to be on the disk, you

should be now able to delete it. After that format the external drive and

you should get rid of it. Did it this way 2 weeks ago with a complete folder

structure and works.

 

Best regards

 

Meinolf Weber

Disclaimer: This posting is provided "AS IS" with no warranties, and confers

no rights.

** Please do NOT email, only reply to Newsgroups

** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm

> I found that I still have a "Sandboxie" folder although I had

> uninstalled it.

> So I decided to delete it but I got a message telling that it couldn't

> delete a file because its name was too long.

> Actually there is a a .htm file whose name is 111 characters long.

> No way to rename, move or delete it.

> I got the same error when I tried to delete it in the DOS window.

> Any suggestion please?

> Thanks

> Horst

Guest John John (MVP)
Posted

Re: Cannot delete a file with a too long name

 

Try substituting the folder in which the file resides for a drive then

try deleting the file from the substituted drive. At the Command Prompt:

 

SUBST x: "c:\Program Files\Some Program Name"

 

To delete the substituted drive:

 

SUBST x: /d

 

John

 

horst wrote:

> I found that I still have a "Sandboxie" folder although I had

> uninstalled it.

> So I decided to delete it but I got a message telling that it couldn't

> delete a file because its name was too long.

> Actually there is a a .htm file whose name is 111 characters long.

> No way to rename, move or delete it.

> I got the same error when I tried to delete it in the DOS window.

> Any suggestion please?

> Thanks

> Horst

Guest h.stroph
Posted

Re: Cannot delete a file with a too long name

 

In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

horst <hweXXX13@bluewin.ch> typed:

> So I decided to delete it but I got a message telling that it couldn't

> delete a file because its name was too long.

> Actually there is a a .htm file whose name is 111 characters long.

> No way to rename, move or delete it.

> I got the same error when I tried to delete it in the DOS window.

> Any suggestion please?

 

Assuming a file named "somehelluvalongfilenamethatstoolongtotype", in a

command window take advantage of the legacy 8.3 convention:

 

dir /x some*

 

will show you the 8.3 filename e.g. "somehe~1" which you can then delete:

 

del somehe~1

Guest Fan924
Posted

Re: Cannot delete a file with a too long name

 

Drag and drop it into the RECYCLED folder and forget about it.

Guest horst
Posted

Re: Cannot delete a file with a too long name

 

On 13.06.2008 19:48, h.stroph wrote:

> In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

> horst <hweXXX13@bluewin.ch> typed:

>

>> So I decided to delete it but I got a message telling that it couldn't

>> delete a file because its name was too long.

>> Actually there is a a .htm file whose name is 111 characters long.

>> No way to rename, move or delete it.

>> I got the same error when I tried to delete it in the DOS window.

>> Any suggestion please?

>

> Assuming a file named "somehelluvalongfilenamethatstoolongtotype", in a

> command window take advantage of the legacy 8.3 convention:

>

> dir /x some*

>

> will show you the 8.3 filename e.g. "somehe~1" which you can then delete:

>

> del somehe~1

>

>

Dear friends,

 

thank you all for your suggestions, though none did work.

But luckily I realized that while the name of the file was only(!) 111

characters long, the whole path was 160 characters long!

i.e. 160+111=271 way more than the maximum allowed length (260)!

Although the calculation is more complex as shown in

http://blogs.msdn.com/saraford/archive/2005/12/15/504240.aspx (only for

those who really want to enter into the details of the matter!)

And so I renamed the 160 character long path to just

C:\a\b\c\d\e\f\g\h\i\j\k\ and then I was able to delete the file and the

whole path!

Thank you again

Horst

Guest Pegasus \(MVP\)
Posted

Re: Cannot delete a file with a too long name

 

 

"horst" <hweXXX13@bluewin.ch> wrote in message

news:OBj1WStzIHA.2360@TK2MSFTNGP05.phx.gbl...

> On 13.06.2008 19:48, h.stroph wrote:

>> In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

>> horst <hweXXX13@bluewin.ch> typed:

>>

>>> So I decided to delete it but I got a message telling that it couldn't

>>> delete a file because its name was too long.

>>> Actually there is a a .htm file whose name is 111 characters long.

>>> No way to rename, move or delete it.

>>> I got the same error when I tried to delete it in the DOS window.

>>> Any suggestion please?

>>

>> Assuming a file named "somehelluvalongfilenamethatstoolongtotype", in a

>> command window take advantage of the legacy 8.3 convention:

>>

>> dir /x some*

>>

>> will show you the 8.3 filename e.g. "somehe~1" which you can then delete:

>>

>> del somehe~1

>>

>>

> Dear friends,

>

> thank you all for your suggestions, though none did work.

> But luckily I realized that while the name of the file was only(!) 111

> characters long, the whole path was 160 characters long!

> i.e. 160+111=271 way more than the maximum allowed length (260)!

> Although the calculation is more complex as shown in

> http://blogs.msdn.com/saraford/archive/2005/12/15/504240.aspx (only for

> those who really want to enter into the details of the matter!)

> And so I renamed the 160 character long path to just

> C:\a\b\c\d\e\f\g\h\i\j\k\ and then I was able to delete the file and the

> whole path!

> Thank you again

> Horst

 

John's suggestion would have worked very nicely, provided that

you access the "undeletable" file from drive X:, not from drive C:.

Guest horst
Posted

Re: Cannot delete a file with a too long name

 

On 15.06.2008 13:00, Pegasus (MVP) wrote:

> "horst" <hweXXX13@bluewin.ch> wrote in message

> news:OBj1WStzIHA.2360@TK2MSFTNGP05.phx.gbl...

>> On 13.06.2008 19:48, h.stroph wrote:

>>> In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

>>> horst <hweXXX13@bluewin.ch> typed:

>>>

>>>> So I decided to delete it but I got a message telling that it couldn't

>>>> delete a file because its name was too long.

>>>> Actually there is a a .htm file whose name is 111 characters long.

>>>> No way to rename, move or delete it.

>>>> I got the same error when I tried to delete it in the DOS window.

>>>> Any suggestion please?

>>> Assuming a file named "somehelluvalongfilenamethatstoolongtotype", in a

>>> command window take advantage of the legacy 8.3 convention:

>>>

>>> dir /x some*

>>>

>>> will show you the 8.3 filename e.g. "somehe~1" which you can then delete:

>>>

>>> del somehe~1

>>>

>>>

>> Dear friends,

>>

>> thank you all for your suggestions, though none did work.

>> But luckily I realized that while the name of the file was only(!) 111

>> characters long, the whole path was 160 characters long!

>> i.e. 160+111=271 way more than the maximum allowed length (260)!

>> Although the calculation is more complex as shown in

>> http://blogs.msdn.com/saraford/archive/2005/12/15/504240.aspx (only for

>> those who really want to enter into the details of the matter!)

>> And so I renamed the 160 character long path to just

>> C:\a\b\c\d\e\f\g\h\i\j\k\ and then I was able to delete the file and the

>> whole path!

>> Thank you again

>> Horst

>

> John's suggestion would have worked very nicely, provided that

> you access the "undeletable" file from drive X:, not from drive C:.

>

>

I was just curious to see if you are right: I recreated the file

(restoring it from a backup) and used John's suggestion.

Actually the command

SUBST x: /d

just eliminates the path x: but not its content.

So I tried in the DOS window (as it is not accepted in the command line)

DEL p:\*.*

and it worked IMHO only because the total length of the path+file name

was now reduced to about 111 characters.

Horst

Guest John John (MVP)
Posted

Re: Cannot delete a file with a too long name

 

horst wrote:

> On 15.06.2008 13:00, Pegasus (MVP) wrote:

>

>> "horst" <hweXXX13@bluewin.ch> wrote in message

>> news:OBj1WStzIHA.2360@TK2MSFTNGP05.phx.gbl...

>>

>>> On 13.06.2008 19:48, h.stroph wrote:

>>>

>>>> In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

>>>> horst <hweXXX13@bluewin.ch> typed:

>>>>

>>>>> So I decided to delete it but I got a message telling that it couldn't

>>>>> delete a file because its name was too long.

>>>>> Actually there is a a .htm file whose name is 111 characters long.

>>>>> No way to rename, move or delete it.

>>>>> I got the same error when I tried to delete it in the DOS window.

>>>>> Any suggestion please?

>>>>

>>>> Assuming a file named "somehelluvalongfilenamethatstoolongtotype", in a

>>>> command window take advantage of the legacy 8.3 convention:

>>>>

>>>> dir /x some*

>>>>

>>>> will show you the 8.3 filename e.g. "somehe~1" which you can then

>>>> delete:

>>>>

>>>> del somehe~1

>>>>

>>>>

>>> Dear friends,

>>>

>>> thank you all for your suggestions, though none did work.

>>> But luckily I realized that while the name of the file was only(!)

>>> 111 characters long, the whole path was 160 characters long!

>>> i.e. 160+111=271 way more than the maximum allowed length (260)!

>>> Although the calculation is more complex as shown in

>>> http://blogs.msdn.com/saraford/archive/2005/12/15/504240.aspx (only

>>> for those who really want to enter into the details of the matter!)

>>> And so I renamed the 160 character long path to just

>>> C:\a\b\c\d\e\f\g\h\i\j\k\ and then I was able to delete the file and

>>> the whole path!

>>> Thank you again

>>> Horst

>>

>>

>> John's suggestion would have worked very nicely, provided that

>> you access the "undeletable" file from drive X:, not from drive C:.

>>

> I was just curious to see if you are right: I recreated the file

> (restoring it from a backup) and used John's suggestion.

> Actually the command

> SUBST x: /d

> just eliminates the path x: but not its content.

> So I tried in the DOS window (as it is not accepted in the command line)

> DEL p:\*.*

> and it worked IMHO only because the total length of the path+file name

> was now reduced to about 111 characters.

 

Maybe I should have given more instructions in my post. When I said

"delete the file from the substituted drive" it meant to navigate to

drive X: and try deleting the file there, or from a command prompt to

use X: for the path (del X:\filename.ext). SUBST x: /d was meant to

tell you how to remove the substituted drive after you were done,

deleting a substituted drive doesn't remove its contents.

 

And by the way, the so-called "long filename" always includes the path,

hence why I suggested substituting the drive, as you had said that the

actual filename (without the path) was only 111 characters, the problem

had to be the length of the path and by using the subst command the path

was reduced to 3 characters. Had you said that the actual name was

greater than 255 characters I would have suggested a different method,

using the subst command would not have sufficiently reduce the filename

length.

 

John

Guest horst
Posted

Re: Cannot delete a file with a too long name

 

On 15.06.2008 19:31, John John (MVP) wrote:

> horst wrote:

>

>> On 15.06.2008 13:00, Pegasus (MVP) wrote:

>>

>>> "horst" <hweXXX13@bluewin.ch> wrote in message

>>> news:OBj1WStzIHA.2360@TK2MSFTNGP05.phx.gbl...

>>>

>>>> On 13.06.2008 19:48, h.stroph wrote:

>>>>

>>>>> In news:%23CmD0zSzIHA.2208@TK2MSFTNGP04.phx.gbl,

>>>>> horst <hweXXX13@bluewin.ch> typed:

>>>>>

>>>>>> So I decided to delete it but I got a message telling that it

>>>>>> couldn't

>>>>>> delete a file because its name was too long.

>>>>>> Actually there is a a .htm file whose name is 111 characters long.

>>>>>> No way to rename, move or delete it.

>>>>>> I got the same error when I tried to delete it in the DOS window.

>>>>>> Any suggestion please?

>>>>>

>>>>> Assuming a file named "somehelluvalongfilenamethatstoolongtotype",

>>>>> in a

>>>>> command window take advantage of the legacy 8.3 convention:

>>>>>

>>>>> dir /x some*

>>>>>

>>>>> will show you the 8.3 filename e.g. "somehe~1" which you can then

>>>>> delete:

>>>>>

>>>>> del somehe~1

>>>>>

>>>>>

>>>> Dear friends,

>>>>

>>>> thank you all for your suggestions, though none did work.

>>>> But luckily I realized that while the name of the file was only(!)

>>>> 111 characters long, the whole path was 160 characters long!

>>>> i.e. 160+111=271 way more than the maximum allowed length (260)!

>>>> Although the calculation is more complex as shown in

>>>> http://blogs.msdn.com/saraford/archive/2005/12/15/504240.aspx (only

>>>> for those who really want to enter into the details of the matter!)

>>>> And so I renamed the 160 character long path to just

>>>> C:\a\b\c\d\e\f\g\h\i\j\k\ and then I was able to delete the file and

>>>> the whole path!

>>>> Thank you again

>>>> Horst

>>>

>>>

>>> John's suggestion would have worked very nicely, provided that

>>> you access the "undeletable" file from drive X:, not from drive C:.

>>>

>> I was just curious to see if you are right: I recreated the file

>> (restoring it from a backup) and used John's suggestion.

>> Actually the command

>> SUBST x: /d

>> just eliminates the path x: but not its content.

>> So I tried in the DOS window (as it is not accepted in the command line)

>> DEL p:\*.*

>> and it worked IMHO only because the total length of the path+file name

>> was now reduced to about 111 characters.

>

> Maybe I should have given more instructions in my post. When I said

> "delete the file from the substituted drive" it meant to navigate to

> drive X: and try deleting the file there, or from a command prompt to

> use X: for the path (del X:\filename.ext). SUBST x: /d was meant to

> tell you how to remove the substituted drive after you were done,

> deleting a substituted drive doesn't remove its contents.

>

> And by the way, the so-called "long filename" always includes the path,

> hence why I suggested substituting the drive, as you had said that the

> actual filename (without the path) was only 111 characters, the problem

> had to be the length of the path and by using the subst command the path

> was reduced to 3 characters. Had you said that the actual name was

> greater than 255 characters I would have suggested a different method,

> using the subst command would not have sufficiently reduce the filename

> length.

>

> John

 

Thank you, John, for your detailed explanations.

The only thing I didn't understand is why DEL X:\*.* does work in the

DOS window but not in the Windows execute line.

Horst

Guest John John (MVP)
Posted

Re: Cannot delete a file with a too long name

 

horst wrote:

> The only thing I didn't understand is why DEL X:\*.* does work in the

> DOS window but not in the Windows execute line.

 

It's not a DOS window, there is no DOS in any of the NT family of

operating systems. It doesn't work in the Run box because del is a

Cmd.exe extension, it's an extended command that can only be run by cmd.exe.

 

John

Guest 3c273
Posted

Re: Cannot delete a file with a too long name

 

 

"John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

news:%23LNCD2wzIHA.3968@TK2MSFTNGP04.phx.gbl...

---snip---

> And by the way, the so-called "long filename" always includes the path,

> hence why I suggested substituting the drive, as you had said that the

> actual filename (without the path) was only 111 characters, the problem

> had to be the length of the path and by using the subst command the path

> was reduced to 3 characters. Had you said that the actual name was

> greater than 255 characters I would have suggested a different method,

> using the subst command would not have sufficiently reduce the filename

> length.

>

> John

 

Out of curiosity, what method would you have suggested if the name/path was

over 255 characters? Also, I never understood how the OS could write a file

that it can't delete without resorting to some trick. I find these in

people's TIF folders all the time. Any insight as to how they get writen in

the first place? Thanks.

 

Louis

Guest John John (MVP)
Posted

Re: Cannot delete a file with a too long name

 

3c273 wrote:

> "John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

> news:%23LNCD2wzIHA.3968@TK2MSFTNGP04.phx.gbl...

> ---snip---

>

>>And by the way, the so-called "long filename" always includes the path,

>>hence why I suggested substituting the drive, as you had said that the

>>actual filename (without the path) was only 111 characters, the problem

>>had to be the length of the path and by using the subst command the path

>>was reduced to 3 characters. Had you said that the actual name was

>>greater than 255 characters I would have suggested a different method,

>>using the subst command would not have sufficiently reduce the filename

>>length.

>>

>>John

>

>

> Out of curiosity, what method would you have suggested if the name/path was

> over 255 characters? Also, I never understood how the OS could write a file

> that it can't delete without resorting to some trick. I find these in

> people's TIF folders all the time. Any insight as to how they get writen in

> the first place? Thanks.

 

The maximum path is well over 32,000 characters (in 255 character

segments, c:\<255 Characters>\<255 Characters\<255...). While the usual

Windows tools and programs expect the path to be less than 260

characters there are other tools that can traverse deep paths, as you

have already mentioned IE for example can traverse deep paths, that is

important for web tools as folders on web servers can easily exceed the

260 character path limit. The tools that create these deep paths can

also delete them, IE for example can delete its own TIF files.

 

Backup utilities are another group of tools that can usually traverse

deep paths, that too is important when backing up deeply nested shares.

With that in mind Robocopy should be able to delete a deeply nested

file or a file with a filename exceeding 255 characters:

 

robocopy c:\LongPath J:\ LongFileName.ext /mov

 

J: could be a flash drive or an empty partition, the /mov option will

delete the source file after the copy operation, after the move the

clip/partition could be formated if need be.

 

John

Guest 3c273
Posted

Re: Cannot delete a file with a too long name

 

 

"John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

news:O5CJVe$zIHA.4676@TK2MSFTNGP05.phx.gbl...

> 3c273 wrote:

>

> > "John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

> > news:%23LNCD2wzIHA.3968@TK2MSFTNGP04.phx.gbl...

> > ---snip---

> >

> >>And by the way, the so-called "long filename" always includes the path,

> >>hence why I suggested substituting the drive, as you had said that the

> >>actual filename (without the path) was only 111 characters, the problem

> >>had to be the length of the path and by using the subst command the path

> >>was reduced to 3 characters. Had you said that the actual name was

> >>greater than 255 characters I would have suggested a different method,

> >>using the subst command would not have sufficiently reduce the filename

> >>length.

> >>

> >>John

> >

> >

> > Out of curiosity, what method would you have suggested if the name/path

was

> > over 255 characters? Also, I never understood how the OS could write a

file

> > that it can't delete without resorting to some trick. I find these in

> > people's TIF folders all the time. Any insight as to how they get writen

in

> > the first place? Thanks.

>

> The maximum path is well over 32,000 characters (in 255 character

> segments, c:\<255 Characters>\<255 Characters\<255...). While the usual

> Windows tools and programs expect the path to be less than 260

> characters there are other tools that can traverse deep paths, as you

> have already mentioned IE for example can traverse deep paths, that is

> important for web tools as folders on web servers can easily exceed the

> 260 character path limit. The tools that create these deep paths can

> also delete them, IE for example can delete its own TIF files.

>

> Backup utilities are another group of tools that can usually traverse

> deep paths, that too is important when backing up deeply nested shares.

> With that in mind Robocopy should be able to delete a deeply nested

> file or a file with a filename exceeding 255 characters:

>

> robocopy c:\LongPath J:\ LongFileName.ext /mov

>

> J: could be a flash drive or an empty partition, the /mov option will

> delete the source file after the copy operation, after the move the

> clip/partition could be formated if need be.

>

> John

>

>

Thanks for taking the time.

 

Louis

Guest John John (MVP)
Posted

Re: Cannot delete a file with a too long name

 

3c273 wrote:

> "John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

> news:O5CJVe$zIHA.4676@TK2MSFTNGP05.phx.gbl...

>

>>3c273 wrote:

>>

>>

>>>"John John (MVP)" <audetweld@nbnet.nb.ca> wrote in message

>>>news:%23LNCD2wzIHA.3968@TK2MSFTNGP04.phx.gbl...

>>>---snip---

>>>

>>>

>>>>And by the way, the so-called "long filename" always includes the path,

>>>>hence why I suggested substituting the drive, as you had said that the

>>>>actual filename (without the path) was only 111 characters, the problem

>>>>had to be the length of the path and by using the subst command the path

>>>>was reduced to 3 characters. Had you said that the actual name was

>>>>greater than 255 characters I would have suggested a different method,

>>>>using the subst command would not have sufficiently reduce the filename

>>>>length.

>>>>

>>>>John

>>>

>>>

>>>Out of curiosity, what method would you have suggested if the name/path

>

> was

>

>>>over 255 characters? Also, I never understood how the OS could write a

>

> file

>

>>>that it can't delete without resorting to some trick. I find these in

>>>people's TIF folders all the time. Any insight as to how they get writen

>

> in

>

>>>the first place? Thanks.

>>

>>The maximum path is well over 32,000 characters (in 255 character

>>segments, c:\<255 Characters>\<255 Characters\<255...). While the usual

>>Windows tools and programs expect the path to be less than 260

>>characters there are other tools that can traverse deep paths, as you

>>have already mentioned IE for example can traverse deep paths, that is

>>important for web tools as folders on web servers can easily exceed the

>>260 character path limit. The tools that create these deep paths can

>>also delete them, IE for example can delete its own TIF files.

>>

>>Backup utilities are another group of tools that can usually traverse

>>deep paths, that too is important when backing up deeply nested shares.

>> With that in mind Robocopy should be able to delete a deeply nested

>>file or a file with a filename exceeding 255 characters:

>>

>>robocopy c:\LongPath J:\ LongFileName.ext /mov

>>

>>J: could be a flash drive or an empty partition, the /mov option will

>>delete the source file after the copy operation, after the move the

>>clip/partition could be formated if need be.

>>

>>John

>>

>>

>

> Thanks for taking the time.

 

You're welcome.

 

John

  • 2 months later...
Guest Jane Fox
Posted

Re: Cannot delete a file with a too long name

 

 

I faced the same problem, I studied it for a long time and how to use

all these commands, and then I simply bought File / Folder Clean-Up

Tool(Long Path) at the address http://www.abtollc.com/products.aspx and

cleaned all unnecessary files.

 

 

--

Jane Fox

------------------------------------------------------------------------

Jane Fox's Profile: http://forums.techarena.in/members/jane-fox.htm

View this thread: http://forums.techarena.in/window-2000-help/985532.htm

 

http://forums.techarena.in

Guest Pegasus \(MVP\)
Posted

Re: Cannot delete a file with a too long name

 

No need to buy a commercial product - setting up a network share

or a substituted drive that points into the middle of the excessively

long path will give you full access to the otherwise inaccessible files.

 

 

"Jane Fox" <Jane.Fox.3ewavb@DoNotSpam.com> wrote in message

news:Jane.Fox.3ewavb@DoNotSpam.com...

>

> I faced the same problem, I studied it for a long time and how to use

> all these commands, and then I simply bought File / Folder Clean-Up

> Tool(Long Path) at the address http://www.abtollc.com/products.aspx and

> cleaned all unnecessary files.

>

>

> --

> Jane Fox

> ------------------------------------------------------------------------

×
×
  • Create New...