Eliminare i file con nomi troppo lunghi
Come riportato nel seguente You can’t delete a file or a folder on an NTFS file system volume tra i vari motivi per cui potrebbe non essere possibili eliminare un file c’è anche il caso in il nome del file completo di path supera il valore MAX_PATH ovvero 260 caratteri (a riguardo si veda il mio post Windows 10: rimozione del limite a 260 caratteri nel path dei file).
Uno dei modi suggeriti in You can’t delete a file or a folder on an NTFS file system volume è quello di utilizzare un tool che permetta di bypassare la limitazione imposta da MAX_PATH:
“Many Windows programs expect the maximum path length to be shorter than 255 characters. These programs only allocate enough internal storage to handle these typical paths. NTFS doesn’t have this limit, and it can hold much longer paths.
You may experience this issue if you create a share at some point in your folder structure that’s already fairly deep, and then create a deep structure below that point by using the share. Some tools that operate locally on the folder tree may not be able to traverse the whole tree starting from the root. You may have to use these tools in a special way so that they can traverse the share. The CreateFile API documentation describes a method to traverse the whole tree in this situation.
Typically, you can manage files by using the software that creates them. If you have a program that can create files that are deeper than MAX_PATH, you can typically use that same program to delete or manage the files. You can typically delete files that are created on a share by using the same share.”
Un tool che permette di eliminare i file con path oltre i 260 caratteri è SuperDelete:
“A Windows command-line tool that can be used to delete files and folders with very long paths (longer than MAX_PATH 260 characters). It supports paths as long as 32767 characters. It works by using extended-length paths and the Unicode versions of the WinApi functions for enumerating and deleting files. In addition, it supports bypassing ACL checks for deleting folders if the user has administrative rights on the drive.”
“In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend “\\?\” to the path”
Per ulteriori informazioni si veda anche Naming Files, Paths, and Namespaces.