简体   繁体   English

如何从adb shell获取android文件系统大小(以字节为单位)?

[英]how can I get android filesystem size in bytes from adb shell?

If I run from android shell the df command I get the sizes of all filesystems in human readable numbers. 如果我从android shell运行df命令,我会得到人类可读数字中所有文件系统的大小。 It seems that the command doesn't take any options (eg -something ). 似乎该命令不采取任何选项(例如-something )。

I want to get the exact size of the filesystem (in bytes). 我想获得文件系统的确切大小(以字节为单位)。

I know I can get the sizes by creating an app which uses statfs. 我知道我可以通过创建一个使用statfs的应用来获得大小。 Is there any OTHER WAY to do it (via command)? 有没有其他办法(通过命令)?

Yes, as long as busybox is installed. 是的,只要安装了busybox。 (And if not, you could prompt the user to install it.) (如果没有,您可以提示用户安装它。)

You can use 您可以使用

busybox df -B 1

to get a report in bytes. 以字节为单位获取报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM