Linux Method for Deleting Special Character File Names or Directories
- 2021-07-10 21:30:39
- OfStack
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 file's inode No.
Delete files by file size
Delete files with zero file 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 Specify directory hierarchy
Summarize