How to delete garbled files and directories under Linux

Patricia Arquette
Release: 2020-01-11 15:18:52
Original
3151 people have browsed it

How to delete garbled files and directories under Linux

Due to encoding reasons, when uploading or creating Chinese files or directories on the Linux server, garbled characters will be generated. If you want to delete it, you will find that it cannot be deleted with the rm command. In this case, use the find command to delete the garbled files or directories.

1. First enter the directory where the garbled file or directory is located, and use thels -icommand to find the inode of the file or directory (the numeric string in front of the file or directory is the inode)

How to delete garbled files and directories under Linux

(Free video tutorial sharing:linux video tutorial)

2. Next, use the find command to query and delete this file or directory

find -inum 2623190 -delete
Copy after login

How to delete garbled files and directories under Linux

#Note: This method only works for deleting files or empty folders.

How to delete non-empty folders?

First check the inode first, and then use the following command:

find -inum 2236429 -exec rm -rf {} \;
Copy after login

It will prompt that the file or folder cannot be found, but it has actually been deleted.

Recommended related articles and tutorials:linux tutorial

The above is the detailed content of How to delete garbled files and directories under Linux. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!