Thursday, July 31, 2008

Cannot delete foldername: The file name you specified is not valid or too long. Specify a different file name.

I was working on of my projects @office and wanted to delete a directory deep in the source tree. I use NTFS partitions(yes I am stuck with Windows XP) and I encountered this funny error:

Cannot delete 'a_huge_pathname/': The file name you specified is not valid or too long. Specify a different file name.

I looked at this and was surprised since I had never heard about this funny business before. The problem was with the path to the file being longer than 255 characters. Anyways had to get going so tried some of the tricks I could of think of then, including couple of lines in Ruby but just could not get through[:(].

Finally I landed here and the revelation was made. I only had to rename a couple of dirs to single char names and Voila! the directory was gone. Hurray! back to business.

2 Comments:

Bhavesh Sanghvi said...

AFAIR, I've faced the issue a couple of times. In such cases, I tried to delete the file permanently (Shift + Delete) since I wanted to delete the file permanently.

Chetan said...

Hmm that's interesting. Why don't we try doing this again?

Post a Comment

Labels