How to delete special character file names or directories in Linux

How to delete special character file names or directories in Linux

Delete a file by its inode number

First use ls -i to find the inode number of the file to be deleted

ls -i |grep xxxxxx|awk '{print $2}'|xargs -i rm -f {}
xxxxxx is the inode number of the file

Delete files by size

Delete files with zero size in the current directory and all subdirectories

find ./ -size 0 -exec rm {} \;

Delete files with zero file size in the current directory (subdirectories are not deleted)

find ./ -maxdepth 1 -empty -type f -print -delete #-maxdepth specifies the directory level

Summarize

The above is the method I introduced to you to delete special character file names or directories in Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Summary of 10 ways to delete files in a directory in Linux
  • Deleting files with spaces in Linux (not directories)
  • Linux uses lsof/extundelete tools to restore accidentally deleted files or directories
  • Deleting files in a directory using C language in Linux

<<:  Vue page monitoring user preview time function implementation code

>>:  MySQL 5.7.17 zip installation and configuration tutorial Solution to MySQL startup failure

Recommend

HTML multimedia application: inserting flash animation and music into web pages

1. Application of multimedia in HTML_falsh animat...

Detailed explanation of CSS margin collapsing

Previous This is a classic old question. Since a ...

How to install MySQL using yum on Centos7 and achieve remote connection

Centos7 uses yum to install MySQL and how to achi...

Vue implements pull-down to load more

Developers familiar with Element-UI may have had ...

How InnoDB cleverly implements transaction isolation levels

Preface In the previous article Detailed Explanat...

onfocus="this.blur()" is hated by blind webmasters

When talking about the screen reading software op...

Four modes of Oracle opening and closing

>1 Start the database In the cmd command windo...

Examples of implementing progress bars and order progress bars using CSS

The preparation for the final exams in the past h...

Mybatis fuzzy query implementation method

Mybatis fuzzy query implementation method The rev...

Detailed Explanation of JavaScript Framework Design Patterns

Table of contents mvc mvp mvvm The source of Vue ...

img usemap attribute China map link

HTML img tag: defines an image to be introduced in...

Analysis of the Nesting Rules of XHTML Tags

In the XHTML language, we all know that the ul ta...

How to remove inline styles defined by the style attribute (element.style)

When modifying Magento frequently, you may encount...