功能是:
递归删除某一个文件夹下(有子文件和子文件夹)的所有 inode link ( iNode 链接数)等于 1 的文件
感谢~
功能是:
递归删除某一个文件夹下(有子文件和子文件夹)的所有 inode link ( iNode 链接数)等于 1 的文件
感谢~
|
filwalineOct 7, 2022
1
|
|
2
不是作业,研究半天写不出来
|
|
NoahNyeOct 7, 2022
3
find . -type l -exec ls -alh {} \;|awk '{if($2=1)print}'
|
|
dorothyRENOct 7, 2022
5
awk 就能筛选出来,然后随便搞个 rm 就行了
|
|
EvineDengOct 7, 2022
6
是指找到没有被硬链接过的文件吗?
|
|
cxtrinityyOct 7, 2022
7
3L 那个只是找出来, 我来个完整的:
find . -type f -exec ls -l {} \;|tr -s " "|cut -d " " -f 9|xargs rm -f |
|
cxtrinityyOct 7, 2022
8
sorry, 忘了 grep inode 1 了, 自己中间加吧
|
|
cxtrinityyOct 7, 2022
9
find . -type f -exec ls -l {} \;|tr -s " "|cut -d " " -f 2,9|grep -E "^1.*"|cut -d " " -f 2|xargs rm -f
|
|
10
@cxtrinityy #9 大佬你这个可以,牛逼!
|
|
cattyhouseOct 8, 2022 via iPhone
11
find . -type f -inum 1 -exec rm {} +
|
|
cattyhouseOct 8, 2022 via iPhone
12
find . -type f -links 1 -exec rm {} +
|
|
echoechoinOct 8, 2022
13
|
|
PeekPopOct 9, 2022
14
12L 最简单
|