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

MySQL parameter related concepts and query change methods

Preface: In some previous articles, we often see ...

Basic usage of find_in_set function in mysql

Preface This is a new function I came across rece...

React native ScrollView pull down refresh effect

This article shares the specific code of the pull...

Basic usage of @Font-face and how to make it compatible with all browsers

@Font-face basic introduction: @font-face is a CSS...

Example code of CSS layout at both ends (using parent's negative margin)

Recently, during the development process, I encou...

htm beginner notes (must read for beginners)

1. What is HTML HTML (HyperText Markup Language):...

Comparison of various ways to measure the performance of JavaScript functions

Table of contents Overview Performance.now Consol...

How to use JavaScript strategy pattern to validate forms

Table of contents Overview Form validation withou...

Detailed explanation of the usage of image tags in HTML

In HTML, the <img> tag is used to define an...

Tutorial on Installing Nginx-RTMP Streaming Server on Ubuntu 14

1. RTMP RTMP streaming protocol is a real-time au...

Mybatis mysql delete in operation can only delete the first data method

Bugs As shown in the figure, I started to copy th...

MySQL tutorial thoroughly understands stored procedures

Table of contents 1. Concepts related to stored p...

Process analysis of deploying ASP.NET Core applications on Linux system Docker

Table of contents 1. System environment 2. Operat...