jinquan26 发表于 2018-8-30 09:39:36

Shell script:将超过指定大小的文件移动至/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


页: [1]
查看完整版本: Shell script:将超过指定大小的文件移动至/tmp/下