Tuesday April 26th, 2016 16:48 Deleting a Windows file whose path/file name is too long (the magic way)

In any shared file system, there will be at least one person who manages to get a file, 13 folders deep, to have a 487 billion-character file name. You will not see this file until it completely screws up a move project.

When you run into such a problem and try to look it up on the internet, there is always the ‘use rd/rmdir’ trick and the subst drive creation trick or robocopy them over to a new dir.

One of those always works, provided you didn’t walk into the situation I did.

Your average person might assume that any person would see the title “Distributed File System” and think that it has something to do with distribution. That the part of it distinctly labeled “Replication” is in some way related to replicating things.

Those people were not my predecessor.

Two major folders, one for user profiles, one simple shared space. The former is set up in DFS replication, but doesn’t replicate anywhere. The latter has a standalone, top-level namespace that points to…a share with an identical path.

This is just the part I could bring myself to investigate. I have no clue what other awful nonsense was going on there, except that it broke all the usual methods of deleting files that had gone over max_path. I decided to try manually changing every folder level to a single character and seeing if that would bring me under 260.

So, here’s the magic part

I went up one level from the errant file and renamed its containing folder to a single character. After that, I went back inside and the actual file was suddenly available for renaming.

Why? I have no earthly idea and I don’t care.

It worked on every single one, so there must be some reason. But this is one of those rare instances where I’m just going to take the money and run.

And since it appears the entire intertubes has never even heard that this was possible, I’m going to spend a few minutes walking around like this:


Los Commentos, as the French say

Your name

Your email

Your URL


IT guy, dev, designer, writer.

Got a degree in print journalism from UF but history dealt some bad cards to that industry, so I moved back to an earlier love: the computer.

Was recently at ZMOS Networks, but am now the Senior IT Associate at the Edna McConnell Clark Foundation.

My name is moderately common, as are a couple screen names, so always look for the logo to make sure you're reading something with official Km approval.

You can get to me directly with kyle(@)kylemitchell.org