-
慕哥9229398
全部解压?7za 格式必须有他专用的解压程序 7z。文件名不要包含空格。for i in *.7zadomkdir -p "x/$i"7z x "$i" -o"x/$i"done7z解压自动使用多cpu核心。4个解压文件一个一个解压比4个同时解压效率高。
-
梦里花落0921
filename=$1dirname=`basename $filename .tar.gz`if [ -z $1 ];thenecho Usage $0 filenameexit 1fiscp root@172.10.1.2:/opt/$file /optcd /opttar zxf $filenamepushd $dirnamefind . -type f -name "*.zip" -exec unzip {} \;find . -type f -name "*.rar" -exec unrar {} \;popd
-
慕哥6287543
#!/bin/bash##for file zip and unzip#date:2011/7/20#input:current_filename#use gunzip\bzip\tar commands to do this .#two choices:pack||unpackpack(){##use tar cmd to pack fileecho "Now will use tar to pack the file......"echo "tar $CUR_FILE ......."#sleep 1tar -zcvf $CUR_FILE.tar.gz $CUR_FILEif [ "$?" -eq "0" ];thenecho "pack file $CUR_FILE into tar.gz file ok~!"elseecho "Error:Pack file into tar.gz failed~!"exit 1fi}unpack(){##get file typeftype=`file $CUR_FILE`#echo file typeecho "Your file type is:###$ftype"case "$ftype" in"$CUR_FILE: Zip archive"*)unzip $CUR_FILEecho "unzip $CUR_FILE OK~!";;"$CUR_FILE: gzip compressed"*)gunzip $CUR_FILEecho "gunzip $CUR_FILE OK~!";;"$CUR_FILE: bzip2 compressed"*)bunzip2 $CUR_FILEecho "bunzip $CUR_FILE OK~!";;*)echo "File $CUR_FILE can not be uncompressed!!!"exit 1;;esac}CUR_FILE="$1"if [ -z $CUR_FILE];thenecho "Please input your filename!"exit 1elseecho "Your file name:$CUR_FILE"##make target choiceecho "Which work you wanna do?"select var in "pack" "unpack";dobreakdoneecho "You selected $var file....."case $var inpack)pack CUR_FILE;;unpack)unpack CUR_FILE;;*)echo "Usage:select option error!"exit 1esacfi