Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deleting files

2 views
Skip to first unread message

Jiao

unread,
Aug 27, 2006, 6:54:01 AM8/27/06
to
Everytime I try to delete a particular file I am told: “Cannot delete file:
The file name you specified is not valid or too long. Specify a different
file name.” When I right click I get a “Open Open with Send to” but nothing
else.

Is there a way to delete this file?

Any help would be great
Thanks heaps

Jiao

John John

unread,
Aug 27, 2006, 8:51:37 AM8/27/06
to
How deep is the file? If it is deeper than 256 characters try reducing
the path by renaming the folders to shorter names. Start at the folder
that contains the file and then move on upwards.

John

Jiao

unread,
Aug 27, 2006, 9:04:02 AM8/27/06
to
Lol. I've tried that. It doesn't even let me rename the file. All the folders
are like 7 characters long >.<!

John John

unread,
Aug 27, 2006, 9:13:50 AM8/27/06
to
How many folders deep is it? All the combined names cannot exceed 256
characters. For example:

C:\Documents and Settings\Administrator\My Documents

is to a depth of 50 characters. If the path is too deep reduce the path
name, not the file name.

John

Jiao

unread,
Aug 27, 2006, 9:25:01 AM8/27/06
to
Awesome. I never knew that. I always thought the file's name itself was the
one that was too long. Thanks heaps. It worked. I renamed everything I could
to "a" and it deleted! Thanks again ^^ Hero!
Sincerely
Jiao

John John

unread,
Aug 27, 2006, 9:40:29 AM8/27/06
to
You're welcome. Lots of people don't know of the 256 characters depth
limit and sometimes they create folders\ inside of folders\ inside of
folders and give them excessively long names and end up in this deletion
predicament. Sometimes renaming the whole tree can be a major pain so
starting at the last folder causes less disruption to the tree
structure. One can also map the file or folder or use the subst command
to reduce the path but that doesn't cure the cause of the problem
itself. In any case, glad to see you got it figured out.

John

Tony Luxton

unread,
Aug 27, 2006, 1:54:34 PM8/27/06
to
Just a thought: could you cut and paste the file into (say) the root folder
and delete it from there?

regards Tony.


John John

unread,
Aug 27, 2006, 10:51:59 PM8/27/06
to
No. When you exceed the path length you can't do anything with the
file. Also, sometimes these long paths are made by programs or tools
than can create and traverse long paths and you can delete or move the
file if you use the application that created the file.

John

Tony Luxton

unread,
Aug 28, 2006, 6:25:16 PM8/28/06
to
I getcha :-)

regards Tony.


at EMR@discussions.microsoft.com Dave at EMR

unread,
Nov 7, 2006, 7:26:01 PM11/7/06
to
John,
This sounds a little like the problem I am having. I have a PDF file in "My
Documents" and the name is extremly long. Adobe Reader says the name is
invalid. I am not able to to anything with it. Open. delete, rename. I
suspect that the combined name and path exceed the limit by a long way. I'm
not sure how to get to the path to rename or reduce. Any help would be
appreciated.

Dave at EMR

John John

unread,
Nov 7, 2006, 9:05:48 PM11/7/06
to
You can try substituting the long path with a drive letter and see if it
shortens it enough to then be able to delete the file. From a Command
Prompt use the subst command, for example:

subst x: C:"\Documents and Settings\Your Username\My Documents"

will substitute the folder path to virtual drive x. You have to use the
"quotation marks as above" when spaces are present in the path or else
the command will fail. After you run the command you should then be
able to try to delete the file from the new drive x, it may have shorten
the path just enough to permit you to delete the file. Once done you
can just delete the substituted drive, that will not delete your folder,
it will only remove the virtual drive associated to the folder. To
delete the drive, once again at the Command Prompt do:

subst x: /d

For help on the command do: subst /?

If that doesn't work you can try using the del command with short file
names. Post again if you need more help.

John

Dave at EMR

unread,
Nov 8, 2006, 9:03:01 AM11/8/06
to
John

Thanks for the quick reply. I have to admit that what you have suggested I
do is WAAAAY over my head. I think I understand the intent of what you are
suggesting, but haven't a clue how to execute it.

Your suggestion "subst x: C:"\Documents and Settings\Your Username\My
Documents""

Does this mean using "Run" from the "Start" menu enter on the command line....

subst x : C: "the path including file name"

Then to delete virtual drive.....

Using "Run" again.....

subst x: /d....where x is the virtual drive and d is my hard drive.

When I do the substitution does x become a file/icon in the "My Documents"
folder that I can just then delete?

Thanks for your help.

Dave

John John

unread,
Nov 8, 2006, 9:30:14 AM11/8/06
to
It's not really all that complicated, run the command I gave you at the
command prompt, here is how it's done:

1- Click on Start Menu | Run
2- In the Run dialogue box type cmd and then press <Enter> or click
on OK.
3- A command session will open, you will then be at the "Command Prompt".
4- Now type in the subst command as described earlier, DO NOT include
the filename in the path.
5- Open Explorer and you will now see drive X, explore the drive and
see if you can now delete the file.
6- Once done delete the virtual drive that you created earlier.

John

Hint: You can copy and paste at the Command Prompt, it saves you from
having to type in the long path and prevents errors. You can copy the
path from the Explorer Address Bar and paste it in the command window.

Dave at EMR

unread,
Nov 8, 2006, 7:18:01 PM11/8/06
to
John

Thank you for walking me through the procedure. I don't often get into the
inner workings of software. Your step by step instruction was extremely
helpful.

It worked great and the file is gone. I plan to keep your instuctions for
possible future use.

Thanks again,
Dave

John John

unread,
Nov 8, 2006, 8:18:28 PM11/8/06
to
You're welcome, thanks for the follow up. I'm happy to see that you
have resolved the problem. For future reference keep in mind that
sometimes the combined path & filename length is too long for the subst
method to work, in these cases there are other methods or tools to use
to try to delete the file.

Mainey

unread,
Jan 31, 2007, 6:56:01 AM1/31/07
to
man i dnt know anything about computers but your step by step work sooooooooo
well thank u i hav been tryin for a while to find out how to get it off thank
u soooo much

John John

unread,
Jan 31, 2007, 8:03:35 AM1/31/07
to
You're welcome.

John

0 new messages