I am almost positive you have run into this error before. Recently I have had 1000s of files like this.
Where did they come from? Both times it was a hidden cache folder for DropBox and AeroFS. I had been playing with both to see if I wanted to use them to sync my files.
Well, I found a simple way to blow these away in one shot, and you can use a tool within windows to do it.
It seems that robocopy can handle these long file names. What you do is you create an empty folder, and then use it to synchronize the copy while telling it to delete all the files that do not exist in the source (Your empty folder)
So if you are running into this, and just want the whole folder gone, get to a command line and create an empty folder.
I created one at c:\empty
And lets say for our example here the offending folder is c:\BadFolder
You would call robocopy like this:
The /e tells it to visit all sub folders even if they are empty, the /mir will tell it to delete any file or folder that does not exist in c:\empty – which is everything.
So there it is. A simple trick to get around those pesky files that windows says are too long – no special tools needed.
Just keep in mind this will delete *everything* not just the long file names. So please think carefully before you use it
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools
{ 6 comments… read them below or add one }
Fantastic tip. I have run into this quite a few times, and so far this is the easiest solution I have ever seen.
Hi Steve,
I hope you are feeling better, and glad to see a new tip this week. This one is a a gem.
Hi Steve,
Thanks for this, I was faced with this issue today, before your mail came thru, and I copied the offending folder while selecting to skip these files as windows couldn’t read them.
Robocopy is much better, I think.
For such a problem I simply rename the parent folder to a shorter name; Simpler and safer. You can rename the parent folder back to its original name once you delete the target folder or file.
Thank you very much for this! I have a 2012R2 box with Mac Files and this happens sometimes with Mac Font files that are 0 bytes in size.
Thank you, thank you, thank you!
I used to have similar problems too, but after using “long path tool” everything was solved. Try this software and you would be glad you did.