How to delete garbled files and folders on a Linux Server

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.