文件信息收集工具

来源:互联网 发布:鞋erp软件xyerp 编辑:程序博客网 时间:2024/05/22 17:31

由于某些特殊的需求,需要查找主机上哪些文件占用了最大的空间,如果是普通的文件直接shell就搞定了,但是项目中这些文件生成的名称是有点特别,每个特定的事物只生成一个文件名,每个文件大小1GB,超过1GB之后,如果这个事务需要继续生成文件,将在文件名之后以数字后缀继续增长。所以自己做了个工具,可以收集、统计【TOP】等等,相对还是简单,但是足够好用了。

ps:有个小bug不想去解决了,也不影响结果。


[gpadmin@sdw1 ~]$ ./gatherfilesinfo --------------------------------------------|       Welcome GatherFileInfos App        ||       Try help for more information      ||             By Gtlions Lai               ||           2015/01/09 15:40:55            |-------------------------------------------- (::GatherFileInfo::)>>help Documented commands (type help <topic>):========================================clear  exit  gather  show  showtop Undocumented commands:======================help (::GatherFileInfo::)>>help gatherGather Dirs Files Infos,usage: gather <dirs-path>.(::GatherFileInfo::)>>gather /data1/primary/gpseg1/base/20350 Will Gather [/data1/primary/gpseg1/base/20350] Files Info. .............. Gather [/data1/primary/gpseg1/base/20350] Files Info Done. (::GatherFileInfo::)>>showtopinput linelimit: 10---------------------------------------------------------------|CTIME              |    DIRS    |   FILENAME    |   FILENUMS|---------------------------------------------------------------| 2015-01-09 15:41:52 | /data1/primary/gpseg1/base/20350 |  | 45943 ||                     |                                  | /data1/primary/gpseg1/base/20350/34172732 | 296 ||                     |                                  | /data1/primary/gpseg1/base/20350/29831572 | 222 ||                     |                                  | /data1/primary/gpseg1/base/20350/32376426 | 222 ||                     |                                  | /data1/primary/gpseg1/base/20350/29826245 | 200 ||                     |                                  | /data1/primary/gpseg1/base/20350/34355832 | 198 ||                     |                                  | /data1/primary/gpseg1/base/20350/34893857 | 198 ||                     |                                  | /data1/primary/gpseg1/base/20350/29837342 | 195 ||                     |                                  | /data1/primary/gpseg1/base/20350/29837446 | 195 ||                     |                                  | /data1/primary/gpseg1/base/20350/29837654 | 195 |(::GatherFileInfo::)>>clear(::GatherFileInfo::)>>showtop 10---------------------------------------------------------------|CTIME              |    DIRS    |   FILENAME    |   FILENUMS|---------------------------------------------------------------(::GatherFileInfo::)>>exit[gpadmin@sdw1 ~]$ 

-EOF-

0 0