Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you delete a file whose name is too long? [closed]

I have never seen this issue before. Have you?

First of all, I have a file on an Windows 7 computer that I first tried to move from one folder to another and it threw an error that said that "The file name(s) would be tool long for the destination folder...".

So I first tried to copy it to the root, C, drive and it threw the same error.

So I tried to delete the file. And it threw the same error because clearly it was going to the Recycle bin.

So I tried alt-delete. Suprisingly, it threw the same error again.

The error says I can try to rename the file. I right click on the file and it does not provide that option.

So then I try the command line window that I open as an administrator. trying to delete the file says that the access is denied.

Yes, it is an AppData folder file, by the way. So it might be because of the system

like image 457
xarzu Avatar asked Jun 21 '12 20:06

xarzu


1 Answers

Sometimes I have had the same problem, and what has worked for me is to run robocopy: Try this: Onto the parent folder in which you want to delete, say parent>:

parent> mkdir new_empty_dir
parent> robocopy new_empty_dir dir_want_to_delete /s /mir
parent> rmdir new_empty_dir
parent> rmdir dir_want_to_delete

Hope this helps somebody else...

like image 76
Jesfre Avatar answered Sep 28 '22 09:09

Jesfre