使用 PHP 脚本获取远程主机上的目录大小
我正在寻找能够递归显示主文件夹中每个文件夹大小的东西。
这是一个带有 CGI-Bin 的 LAMP 服务器,因此大多数 PHP 脚本都应该工作或任何可以在 CGI-Bin 中工作的东西。
我的托管公司没有提供界面让我查看哪些文件夹占用的空间最多。 我对互联网上的任何内容一无所知,并进行了一些搜索,但没有得到任何结果。
实现图形的东西(GD/ImageMagick) 是最好的,但不是必需的。
我的主机在 CGI-BIN 中仅支持 Perl。
I'm looking for something that will show me the size of each folder within my main folder recursively.
This is a LAMP server with a CGI-Bin so most any PHP script should work or anything that will work in the CGI-Bin.
My hosting company does not provide an interface for me to see which folders are consuming the most amount of space. I don't know of anything on the Internet and did a few searches however I came up with no results.
Something implementing graphs (GD/ImageMagick) would be best but not required.
My host supports only Perl in the CGI-BIN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
number_files_and_size.php
number_files_and_size.php
如果您有 shell 访问权限,则可以运行该命令
,或者如果 PHP 配置为允许执行,则可以使用该命令:
If you have shell access you can run the command
or perhaps use this, if PHP is configured to allow execution:
奇怪的是,我在 Google 上发现了 许多相关结果和这个 > 可能是最完整的。
代码
使用
输出
Strange, I came up on Google with many relevant results and this one is probably the most complete.
Code
Usage
Output