Especially when deleting files in a large file system, deletions via the standard Windows Explorer can fail very quickly because the Windows operating system determines that the source path or the file name is too long to be edited. We have already described that Windows can only process file names or folder names with a length of 260 characters .
Nevertheless, it can happen that this limit is exceeded by copying and that the following error messages can occur when moving, copying or deleting files and folders.
The exact error message is:
Source path is too long
The source file names are too long for the file system. Move them to a different location that has a shorter path name or rename them to shorter names before continuing.
There is the same message again, in which case the file in question is also displayed. It looks like this.
To solve the problem it is of course possible to shorten the folder and file names in question in the file system and to gradually delete the problem files manually. However, this cannot be a solution for a really large file system, because this length problem can occur extremely frequently. That is why we were looking for a simple solution .
Use Robocopy to delete source file names that are too long
The easiest and best solution is to solve the problem with Robocopy. With the ” / MIR ” command you can simply have an existing directory matched with an “empty” directory and the differences are automatically deleted by Robocopy. Robocopy doesn’t seem to have any problems with file or folder names that are too long. Everything you had to do, we will briefly describe here.
1. Create an empty directory
First you just have to create an empty directory, in our case we simply created a folder on the D: partition with the name ” D: Leer “.
2. Create an empty directory
Then you open a command prompt with administrator rights and change to the problem directory, which you cannot delete. It is imperative that you are in the correct source folder by deleting the data. Enter the following command there.
robocopy D: Leer. /ME
It is important that there is a space before and after the period and of course you have to change the name of the ” space “.
ATTENTION: Please make sure that you are really in the right directory, otherwise you may accidentally delete other important files.
Then Robocopy easily solves the too long paths in the file system.
Robocopy is one of the most helpful Microsoft tools ever and that’s why we have already written numerous articles on ” Robocopy “. Here is a selection of the most popular articles.
– Accelerate Robocopy with parameter / MT
– Robocopy – Prevent copying of already existing files again – Parameter / FFT
– Copy directories without authorization with Robocopy
– Robocopy error while copying 0x80070021
– Robocopy error 1392 (0x00000570) – The file or the directory is damaged and unreadable.
– delete folders except for the last …