快速找出哪些目录/文件占用了您的磁盘空间。
sp的Python项目详细描述
我曾经为特纳广播公司工作,我们使用了一个内部Perl脚本 命名为sp以查找占用服务器磁盘空间的文件。我早就走了 特纳,我从来没有带过源代码,所以我决定 用python重新编写。
简而言之,它的作用如下:
- Recurse through directories from a starting point (current working dir, or a directory you specify)
- Gather all file sizes, and therefore, also directory sizes.
- List all directories largest to smallest, and same for files.
- Be able to ignore files less than a certain size while still letting their size count toward their parent directory’s size.
- Be able to ignore directories less than a certain size while still letting their size count toward their parent directory’s size.
- Limit number of files displayed per directory. For instance… Show only the top 15 largest files.
- Limit depth to recurse.
安装
sp使用setuptools进行安装。它没有依赖关系。SP是 易于安装:
$ easy_install sp
或者,下载并解压缩tarball并安装:
$ tar zxf sp-1.0.2.tar.gz $ python setup.py install
在UNIX系统上,如果需要安装 脚本到需要根权限的目录:
$ sudo python setup.py install
开发git存储库可以匿名签出:
$ git clone https://github.com/pthrasher/sp.git<> P>有一个小改动,您可能需要考虑安装。由 默认情况下,setuptools间接安装脚本;安装到 $prefix/bin或python2xscripts使用setuptools的pkg_资源模块加载 安装脚本的sp egg的确切版本,然后运行脚本的 main()函数。这通常不是一个坏特性,但是它可以增加 像sp这样的小型命令行实用程序的启动开销。 sp的响应是snappier,我建议安装自定义脚本 导入sp模块并运行sp_main()函数。查看文件 例如/sp。
使用sp
使用默认设置从当前目录递归搜索:
$ sp
要做其他事情,请参阅帮助。
$ sp –help
待办事项
- 添加文件/文件夹排除列表。
虫子之类的
如果你发现了一个bug,或者你真的想添加的功能缺失,请发布到 github.com上的issue-tracker或发电子邮件给作者 <;philipthrasher@gmail.com>;。