bash遍历目录压缩文件

#!/bin/bash  
function dir(){  
  for file in ` ls $1 `  
  do  
    if [ -d $1"/"$file ]  
    then  
      dir $1"/"$file  
    else  
      echo $1"/"$file
      7za a -mx=9 ~/Desktop/""$file"".7z $1"/"$file
    fi  
  done  
}
dir $1

 

posted @ 2017-11-23 02:31  Bob-wei  阅读(215)  评论(0编辑  收藏  举报