I’m certain there have been times where you got frustrated with trying to do a simple task and end up hours in putting a fix to a problem. In this guide, I will tackle one of these problems and hopefully try to make your life easier.
- Trying to copy files and you get the “Destination Path Too Long” error
Let’s say I’m copying files from Location A to Location B and I get the error of “Destination Path Too Long” error. What do I do? First, you need to understand what the error means, by default in Windows, you cannot have a path including filename that is 256 characters or longer. To get past this problem what you can do is use the Windows built-in utility called “Robocopy”. I will suggest you to carefully read the help using robocopy /? and understand how you should do it, preferably even talk to your System’s Administrator before you proceed with it as using it without knowledge and experience can put you deeper down the rabbit’s hole.
Now let’s look at the results, it was even faster in copying the data files than using the standard copy/paste. Word of advice, use the /XD parameter to ensure that windows system folders like RECYCLER are not copied along into the destination.
2. Now let’s say after a while, you don’t really need this folder and though you did bypass the copy error for Destination Path Too Long, however, you didn’t anticipate that you will also get the same error when you’re trying to delete this folder.
Let’s give it a try using Shift + Delete to see if we can forcefully delete all these files:
Once you click Yes, it will delete all the files it can before it goes into the same error that popped up during the copy process.
What do we do now?
Well, like any sane person, you would think of trying to delete files individually, but that’s not going to work.
The solution is simple, you use the same robocopy logic and let’s mirror a newly created empty folder on this path.
…and you’re all set. Now all of you have to do is clean up the empty directories and you’re all set.