How to delete garbled files and folders on a Linux Server
Due to the trend of php, there are more and more opportunities to access Linux servers. Different from Windows servers, Linux servers only support numbers, English letters, and other characters, and cannot recognize Chinese characters. Therefore, Chinese garbled files and folders are displayed after We decompress the package and upload files. There are many solutions on the Internet, but today we can use the find command to quickly delete garbled files and folders, so I would like to share with you.
On the homepage, enter the folder where the garbled file is located.
Use the ls-I command to find the node number of the file or folder
The preceding node number is used. Run the find command to query and delete the node number.
-Inum indicates query by node number;-delete indicates deletion. In this way, the garbled file is successfully deleted. It is worth noting that this method is only applicable to deleting files or empty folders.
For folders, especially non-empty folders, the above method is not applicable. You need to use another parameter to implement it. First, the same is to view the node number of the garbled folder.
Next, run the find command to delete the file.
Although we are prompted that we cannot find this file or folder, it indicates that it has been deleted. -Exec is used to execute the command after searching, where {} represents the result of the previous query, and the Space + \; is the ending character. If it is other words, it will not be said. -Exec can be followed by any common commands. Therefore, this method is not only applicable to folders, but also to files.
How can I batch delete it? In fact, it's very easy to use.
File
Folder
$ N is the variable name, which is the same as the variable name defined after for. It is applicable to other operations.
Postscript
It applies not only to deletion, but also to other basic operations, such as renaming, moving, and copying.
This article permanently updates the link address: