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