# ./bin/ls --version
ls (GNU coreutils) 8.32
# ./bin/ls -l /sdcard/DCIM/*.jpg
-rw-rw---- 1 root sdcard_rw 269252 Oct 14 15:53 /sdcard/DCIM/1622076503143.jpg
-rw-rw---- 1 root sdcard_rw 168161 Oct 14 15:53 /sdcard/DCIM/1634197836174.jpg
-rw-rw---- 1 root sdcard_rw 269252 Oct 14 15:53 /sdcard/DCIM/1634197932013.jpg
# ./bin/tar --version
tar (GNU tar) 1.32
# ./bin/tar -vcf a.tar /sdcard/DCIM/*.jpg
./bin/tar: Removing leading `/' from member names
/sdcard/DCIM/1622076503143.jpg
./bin/tar: Removing leading `/' from hard link targets
/sdcard/DCIM/1634197836174.jpg
/sdcard/DCIM/1634197932013.jpg
`/' from member names 是指路径 /sdcard 最开始的 /吧
`/' from hard link targets 又是啥?
# ./bin/stat /sdcard/DCIM/*.jpg
File: /sdcard/DCIM/1622076503143.jpg
Size: 269252 Blocks: 528 IO Block: 4096 regular file
Device: 17h/23d Inode: 500816 Links: 1
Access: (0660/-rw-rw----) Uid: ( 0/ root) Gid: ( 1015/sdcard_rw)
File: /sdcard/DCIM/1634197836174.jpg
Size: 168161 Blocks: 336 IO Block: 4096 regular file
Device: 17h/23d Inode: 500832 Links: 1
Access: (0660/-rw-rw----) Uid: ( 0/ root) Gid: ( 1015/sdcard_rw)
File: /sdcard/DCIM/1634197932013.jpg
Size: 269252 Blocks: 528 IO Block: 4096 regular file
Device: 17h/23d Inode: 500821 Links: 1
Access: (0660/-rw-rw----) Uid: ( 0/ root) Gid: ( 1015/sdcard_rw)
# ./bin/sha256sum /sdcard/DCIM/*.jpg
82bc14f5ccbbb71f1985bf462c738212cb82c1af99cde7c82031fd3b234bc0c0 /sdcard/DCIM/1622076503143.jpg
a218e03bbf3e656ec0cb6e6de7927827ce187a7fe72240b129714e76c1c95f3c /sdcard/DCIM/1634197836174.jpg
82bc14f5ccbbb71f1985bf462c738212cb82c1af99cde7c82031fd3b234bc0c0 /sdcard/DCIM/1634197932013.jpg
1
SenLief 2021-10-14 16:46:29 +08:00
加个参数 P
|
2
AoEiuV020 2021-10-14 16:55:06 +08:00
还真没注意过这提示,
总之就是有硬链接,ls -li 可以看到 inode 相同的文件就是硬链接, 试了下硬链接提示后面的一个文件会被 tar 打包成软链接, |
3
AoEiuV020 2021-10-14 16:56:19 +08:00
不对啊,看你这路径是安卓手机拍照或者截图的文件?为什么会出现硬链接?
|
4
JinTianYi456 OP |
5
JinTianYi456 OP #4 但打包后并木有减少体积,有点奇奇怪怪
|
6
yanqiyu 2021-10-14 23:16:53 +08:00
@JinTianYi456 tar 默认只是打包不会压缩,压缩是 -z 选项,会用 gzip
|
7
JinTianYi456 OP @yanqiyu #6 结合#2 看我说的,此贴并未涉及压缩
|
8
bao3 2021-10-15 03:17:42 +08:00 via iPhone
tar 只是打包,不压缩,所以大小变化不大是正常的。
/ 默认是会被去掉,因为这个太危险了。 至于 hardlink,不懂安卓,可能 /sdcard 本身是个 hardlink,比如可能是 /……/storage/external/sdcard 之类的? 只折腾过 Android TV,所以只能提供个思路,不要当成是真实的路径哈 |