A simple way to delete a folder with a long name on Windows
This is a situation that is quite common for Windows users. This phenomenon is when we copy, cut, move, delete, rename ... or do anything to the directory, data file that has a length in the path that exceeds 255 characters in Windows (theoretically on Microsoft is 260 characters), the system will display the error as below. So how to delete files and folders with long path names ???
Yes, friends. This is a situation that is quite common for Windows users. This phenomenon is when we copy, cut, move, delete, rename . or do anything to the directory, data file that has a length in the path that exceeds 255 characters in Windows (theoretically on Microsoft is 260 characters), the system will display an error as shown below:
- Tên tập tin tên (s) bị lớn hơn được hỗ trợ bởi hệ thống tập tin. Đang thử chuyển đến một vị trí mà có tên đường dẫn nhỏ hơn, hoặc renaming để đóng tên (s) trước khi thử này.
Illustrative error occurred on Windows 7
Or here:
This error message is similar:
-
Lỗi lỗi bất thường, giữ lại bạn từ thư mục. Nếu bạn tiếp tục để nhận lỗi này, bạn có thể sử dụng mã lỗi để tìm kiếm để làm việc với lỗi này.
-
Error: 0x80004005: Unspecified error
For these types of errors, even if you use assassins like Folder Lock, Folder Guard, Unlocker . they don't lose. Even the PowerShell utility still has to bundle:
- Remove-Item: Đường dẫn đưa ra, tập tin tên, hoặc cả hai là quá dài. Những đủ xác định tập tin tên phải là ít hơn 260 ký tự, và tên thư mục phải là ít nhất 248 ký tự.
Simply because PowerShell cannot support all files, the directory path is longer than 255 characters, even if the partition you are storing is in NTFS format. However, not all ways to handle this situation. In the article below, TipsMake.com will introduce to you a rare tool that can help us overcome this situation. That is the software support Long Path Tool , link download the latest version here.
How to use the Long Path Tool is quite simple, please see the video tutorial below:
But besides, do you know that there are still tools available from Microsoft that support this very well, that is Robocopy . In essence, Robocopy works as follows:
- When used with the command / MIR, Robocopy will proceed to create a backup of the entire folder, the current file name on another partition, and when your root folder is empty - empty then the system The system will delete the current files and folders.
As shown in the example image above, you can see in the game folder that has the directory, in which there are many other subdirectories, so the total number of characters appearing on the path has exceeded 260 characters, and leads As a result, it is impossible to delete, move, copy or rename those folders. Or here, I have 3 subdirectories with the same path structure as above. And of course, Windows Explorer can't do anything right now:
At drive C (or any other drive), I create a new empty folder (name it whatever you want), then use the following command to copy the entire HomeDrives internal directory to the new address:
- robocopy / MIR c: test E: UserDataHomeDrives
After executing the above command, the entire directory inside E: UserDataHomeDrives has been deliberately deleted, and our rest has been much simpler. Robocopy has shown its immensely powerful ability to handle, copy, delete, rename folders with too long names, exceeding the standard 255 characters of Windows and you still don't have to use support tools. external support.
Video demo using Robocopy to remove files and folders with too long names in Windows:
How to delete a long name directory with the command line tool
In addition to the above two ways, deleting the long name directory with the command line tool is a simple three-step process. The trick is to automatically create shorter names and use it.
- Open the command prompt in the file folder.
- Use the DOS command to get a short file name in 8.3 file format.
- Now, use the DEL command in DOS to delete the file.
See how this tool works in the example below with a long name file in the directory.
Open File Explorer and browse for files in the folder. Press Shift , then right-click an empty area. Select Open command window here . The Command Promt window will appear with a link to the folder you are visiting.
Enter the DOS command to list the folders and files in the current directory. The dir command is an internal command and is available on all Microsoft operating systems. The / X attribute displays short names for non-8.3 file names. You can also use DIR / X / P to pause and switch from one screen to the next screen when there are too many files to check.
The screenshot below shows the text file that we want to delete with the edited short file name.
So you can see how we use DOS to automatically create a shorter name for the file. Now just use the simple DEL command on the short file name to remove the file.
The lesson here is to not ignore DOS. There are many useful DOS commands that can save you time.
Good luck!
You should read it
- How to fix the long path of the directory path on Windows
- Did you know Windows 10 solved the path problem longer than 260 characters? Read the article below
- How to Map a Folder to a Drive Letter in Windows
- How to exclude files and folders with Robocopy in Windows 10
- Robocopy command in Windows
- Giraffes have a long neck not to eat leaves on the tops of trees?
- How to do and research on Long Tail Keyword in SEO - Part 1
- How to take a long screenshot on a Windows 11 computer
- Strange spider species called 'Daddy loves long legs'
- What is the directory $ WINDOWS. ~ BT, can delete $ WINDOWS. ~ BT or not?
- Instructions for fixing errors 'Cannot delete folder: The directory is not empty'
- 30+ the best long hair styles for girls