I have extracted a backup file of WordPress website (from Linux server) on Windows desktop. But when I try to delete the folder, I get this error message:
Source Path Too Long The source file name(s) are larger than is supported by the system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation.
This error occurs because Windows explorer can’t handle any file or folder that has full path longer than 255 characters. In this article, I will show 2 methods to delete files or folders that have source path too long issue.
Watch on YouTube
Use subst command to shorten a full path
You can use subst command to map a path with a drive letter in order to shorten full path. In this example, I will map this path – C:\Users\linglom\Desktop\public_html\wp-content\cache to z:\
- Copy a path that you want from the address bar on Windows Explorer.
- Open Command Prompt by right-click Windows icon at bottom left and select Command Prompt.
- Type this command and press Enter.
subst z: C:\Users\linglom\Desktop\public_html\wp-content\cache
- Open Windows Explorer and browse to Z:\. You can now delete or rename these files.
- When finishes, you can remove this virtual drive by type this command.
subst z: /d
Delete long path files with 7-Zip
You can use 7-Zip File Manager to handles long path folders and files.
- Download and install 7-Zip from http://www.7-zip.org/download.html.
- Open 7-Zip File Manager.
- Browse to a path that you can see the folder that you want to delete. Select the folder and press Shift + Delete to delete a folder instantly (without moving it to recycle bin)
Note: Make sure that you select a folder that you really want to delete before proceed.
- Click OK to confirm.