9

Ubuntu如何删除中文文件名乱码的文件

 3 years ago
source link: https://xushanxiang.com/2019/09/ubuntu-how-to-delete-garbled-files-with-chinese-file-names.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Ubuntu如何删除中文文件名乱码的文件

作者: xusx 分类: Linux 发布时间: 2019-09-25 10:23

前阵子,进行svn操作时,中途报错:

svn: E000022: Error converting entry in directory '/xushanxiang.com/js/p' to UTF-8
svn: E000022: Can't convert string from native encoding to 'UTF-8':
svn: E000022: json_data (?\229?\164?\141?\228?\187?\182).js

于是想用rm命令把它们删掉,但提示没有此文件,当然也没法输入中文路径。于是百度了一下,一种方案是:

使用ls -i命令找到文件或文件夹的节点编号,再用find命令删除Linux下乱码文件及文件夹,过程如下:

ls -i
# 得到:2360009 json_data (??????).js
find -inum 2360009 -delete

-inum指根据节点号查询;

-delete顾名思义就是删除操作了。这样就成功删除乱码文件了。

注:此方法只适用于删除文件或空的文件夹。

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK