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:

  1. 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.

Picture 1 of A simple way to delete a folder with a long name on Windows

Illustrative error occurred on Windows 7

Or here:

Picture 2 of A simple way to delete a folder with a long name on Windows

This error message is similar:

  1. 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.

  2. Error: 0x80004005: Unspecified error

Picture 3 of A simple way to delete a folder with a long name on Windows

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:

  1. 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ự.

Picture 4 of A simple way to delete a folder with a long name on Windows

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:

  1. 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:

Picture 5 of A simple way to delete a folder with a long name on Windows

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:

  1. robocopy / MIR c: test E: UserDataHomeDrives

Picture 6 of A simple way to delete a folder with a long name on Windows

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.

  1. Open the command prompt in the file folder.
  2. Use the DOS command to get a short file name in 8.3 file format.
  3. 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.

Picture 7 of A simple way to delete a folder with a long name on Windows

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.

Picture 8 of A simple way to delete a folder with a long name on Windows

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.

Picture 9 of A simple way to delete a folder with a long name on Windows

The lesson here is to not ignore DOS. There are many useful DOS commands that can save you time.

Good luck!

Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile