A BASH Script to Find Big Files

本文介绍了一个用于查找特定路径下大于100MB的大文件的bash脚本,并演示了如何运行该脚本将结果输出到文件中。

#!/bin/bash
# if nothing is passed added, show usage and exit
[[ -n "$1" ]] || { echo “Usage: ./findbigfiles.sh [PATHNAME::Usage: /;/temp;]“; exit 0 ; }
find $1 -type f -size +100000k -exec ls -ltr {} \; | awk ‘{ print $9 “: ” $5 }’

—————————————-

Use It : ./findbigfiles.sh/opt >findbigfiles.txt &

—————————————-

root@testsvr1# ./findbigfiles.sh / >findbigfiles.txt &
[1] 27857

V27960021@dg03podv27960021kj4p:~/存储/casio/24608/存储2$ python storage.py ./测试 ./对比 24608_report_dual.xlsx 警告: lpdump文件不存在 - path/to/machine1/files/18_lpdump.txt 警告: lpdump文件不存在 - path/to/machine2/files/18_lpdump.txt 警告: 文件不存在 - path/to/machine1/files/02_system.txt 警告: 文件不存在 - path/to/machine2/files/02_system.txt 警告: 文件不存在 - path/to/machine1/files/03_vendor.txt 警告: 文件不存在 - path/to/machine2/files/03_vendor.txt 警告: 文件不存在 - path/to/machine1/files/04_product.txt 警告: 文件不存在 - path/to/machine2/files/04_product.txt 警告: 文件不存在 - path/to/machine1/files/05_odm.txt 警告: 文件不存在 - path/to/machine2/files/05_odm.txt 警告: 文件不存在 - path/to/machine1/files/06_my_product.txt 警告: 文件不存在 - path/to/machine2/files/06_my_product.txt 警告: 文件不存在 - path/to/machine1/files/07_my_engineering.txt 警告: 文件不存在 - path/to/machine2/files/07_my_engineering.txt 警告: 文件不存在 - path/to/machine1/files/08_my_stock.txt 警告: 文件不存在 - path/to/machine2/files/08_my_stock.txt 警告: 文件不存在 - path/to/machine1/files/09_my_heytap.txt 警告: 文件不存在 - path/to/machine2/files/09_my_heytap.txt 警告: 文件不存在 - path/to/machine1/files/10_my_company.txt 警告: 文件不存在 - path/to/machine2/files/10_my_company.txt 警告: 文件不存在 - path/to/machine1/files/11_my_carrier.txt 警告: 文件不存在 - path/to/machine2/files/11_my_carrier.txt 警告: 文件不存在 - path/to/machine1/files/12_my_region.txt 警告: 文件不存在 - path/to/machine2/files/12_my_region.txt 警告: 文件不存在 - path/to/machine1/files/13_my_preload.txt 警告: 文件不存在 - path/to/machine2/files/13_my_preload.txt 警告: 文件不存在 - path/to/machine1/files/14_data.txt 警告: 文件不存在 - path/to/machine2/files/14_data.txt 警告: 文件不存在 - path/to/machine1/files/15_my_bigball.txt 警告: 文件不存在 - path/to/machine2/files/15_my_bigball.txt 警告: 文件不存在 - path/to/machine1/files/16_my_manifest.txt 警告: 文件不存在 - path/to/machine2/files/16_my_manifest.txt 警告: 文件不存在 - path/to/machine1/files/17_vendor_dlkm.txt 警告: 文件不存在 - path/to/machine2/files/17_vendor_dlkm.txt 报告生成成功: storage_comparison_report.xlsx 文件在脚本路径下文件结构如下:storage.py 测试(文件夹:测试机抓取的数据)对比(文件夹:对比机抓取的数据)
11-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值