将超过指定大小的文件移动至/tmp/下。如下:
#!/bin/bash #Program: # Use move file of input to the size. #History: #2014/03/07 Chris First release PATH=${PATH} export PATH read -p "Please input the directory of files: " -t 30 dir read -p "Please input the need to move to "/tmp/" the size of file ( Example==> 10240 "Unit:Byte" ): " -t 30 fs cd $dir for mfn in $(ls -al | awk '$5 > $fs {print $9}') do mv $mfn /tmp echo "Had been moving: $mfn" done exit 0
转载于:https://blog.51cto.com/yinkai/1375552