“Destination Path Too Long” when copying files in File Explorer? Easy workaround(s)!

This post was most recently updated on August 29th, 2024.

3 min read.

This article explains another situation where you might run into a “The file names would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path” error, and how to get around it.

Don’t install “LongPathTool”, which is what all the spam comments online tell you to do. Maybe it’s even on Google/Bing Ads nowadays. Instead, learn to use Windows the way it was meant to be used – without windows.

Read on to expand your consciousness with yet another workaround!

Problem

If you’ve ever used Windows, you might’ve run into this fun error:

You can “fix” this by enabling long file paths – something Windows has supported from around 1995, but it has always been disabled by default for backwards compatibility reasons. The sensibility of this decision can be argued either way, but I guess you rarely need paths over 260 letters long – unless you’re using OneDrive…

Solution

Kinda funny having this disabled by default. But backwards compatibility is important, so I won’t complain about it too much. Besides, there’s an easy UI for enabling longer paths, and it’s called regedit.

And that easy switch fixes like 50% of the problem. So the first part of our 2-part solution starts here:

1. Open RegEdit

Hit win+r, enter “regedit” and hit enter – or just search for “Registry Editor” if your Start Menu works.

2. Enable long paths

Copy-paste the following to the navigation bar to navigate to LongPathsEnabled:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled

And set the value to 1.

3. You are good (with caveats)!

And now your system supports longer paths (over 32000 characters long, to be imprecise)! You’re good. Kind of.

All that said, there’s a bit of a caveat there: since File Explorer is not considered a very important piece of an Operating System (everyone accesses their files from command line anyway, right?), it will not support this easy UI switch (i.e. the registry hack you just successfully executed).

You can access files, sure, but you can’t create new ones or move old ones to paths longer than 260 letters (or 400, with the path and file name combined).

See, the File Explorer, being a very noncentral part of Windows (it’s not like you should use a “window” – such as File Explorer – in Windows, after all), seemingly only gets critical updates like context menu without content and Copilot-integration. Non-critical stuff like “adhering to Operating System -level registry values” or “Honoring Group Policies” aren’t exactly a priority.

And to be fair, it’s meant for “exploring”, not “creating” or “moving” files after all. File Explorer, not File Mover.

(And this brings us to the part 2 of our 2-part solution…)

4. Move your files with something else

So here’s the solution workaround: Forget about using File Explorer and use something else.

Essentially, you have 2 main options:

  1. Use a better File Explorer option (something that’s still maintained)
  2. Use a command line -tool like PowerShell or robocopy

So instead of using an UI (like File Explorer), I chose to use PowerShell.

With PowerShell, you can copy the contents of a folder (including subfolders) like this:

Copy-Item -Path "output\*" -Destination "C:\projects\target" -Recurse -Force

(-Recurse makes sure the whole directory is copied over, and -Force means pre-existing files are overwritten)

You could also use Copy-Item, or Rename-Item, depending on your exact use case.


And there you go. That’s how to use Windows the way it was meant to be used: without using windows.

mm
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments