Fixed an issue where file deletion failed due to too long source path
Are you having trouble deleting certain files because your computer keeps showing "The source file name is larger than the size supported by the system. "? For long file names (LFN), Windows only supports file names up to 255 characters. If the file name has more characters than specified, the file cannot be deleted as in File Explorer. You can use two different methods to delete files from your system.
Way 1 – Delete it from Terminal
You must use the Command Prompt Terminal to delete this file.
Know the address of the file you want to delete.
1. Open File Explorer and navigate to the file directory.
2. Once there, click on the address and copy it.
3. Just press the Win key and start writing "cmd".
4. Once you see "Command Prompt" appear in the search results, just right-click on it and click "Run as administrator ".
5. Later, just type this code and paste the location of the file and press Enter to access the location.
cd 文件路径
[
Example - in our case as the path to the file -
C:\Users\Sambit\Music\New Folder\New Folder
Then, the code will be -
cd C:\Users\Sambit\Music\New 文件夹\New 文件夹
]
This will display a list of files and folders for that address. The file you want to delete will be shortened to one word. Now, just write down the name of the file.
6. Now finally, write this line and delete it from the system using the shortened name of the file.
DEL缩短的文件名
[
Example - In our example, the name of the file is "WHYTHI~1.TXT". So, the order is——
DEL WHYTHI~1.TXT
]
That’s all! This is the easiest way to delete files from your system.
Method 2 - Using subst command
There is another way to delete files.
1. Open File Explorer and navigate to the file location.
2. Once there, click on the address and copy it.
Now, close File Explorer.
3. Now, once you have the file location, press the Win key and enter "Command".
4. After that, right-click on “Command Prompt” and click on “Run as administrator”.
#5. When the terminal appears, enter this code and paste the location you copied.
subst z:复制的路径
[
There should not be any spaces in the path
Example – Paste the copied path into the command. In our case, the command would be -
subst z: C:\Users\Sambit\Music\Newfolder\Newfolder
]
This will map the folder to the folder labeled " z:" new drive.
6. Open File Explorer and you will notice that there is a new drive named " Z: " drive.
7. Just select it and hit the Delete key on your keyboard to delete it from your system.
Now if you want to remove the drive from file explorer just execute the following code-
子 z: /d
This will remove the drive from File Explorer.
Method 3 – Using the 7zip Installer
You can download and use 7zip to delete the folder.
1. Open the 7zip installer on your browser and click "Download".
#2. After that, double-click the downloaded installer file.
3. Now, just click on "Install" to install the package on your system.
关闭安装程序。
4. 现在,从 Windows 搜索框中搜索“ 7zip ”。
5. 点击“ 7zip 文件管理器”。
[
你也可以这样打开——
Windows 开始菜单 > 所有应用 > 7zip > 7zip 文件管理器
]
6. 当文件管理器打开时,导航到要删除的文件的位置。
7. 然后,选择文件并同时按Shift+Delete键以删除文件。
这将确保删除的文件不会进入回收站并被永久删除。
The above is the detailed content of Fixed an issue where file deletion failed due to too long source path. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools