日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

Bzip2 Howto( 六 )


--------------------------------------------------------------------------------

10. 使用 bzip2 來再壓縮其他的壓縮格式
下面的 perl 程式會把以下列的壓縮格式檔 (.tar.gz, .tgz. .tar.Z, 和 .Z for this iteration) 重新打包成最佳的壓縮值 。這 perl 原始程式都有全方位的好文件來說明它做什麼以及它如何辦到的 。

#!/usr/bin/perl -w

#######################################################
# #
# This program takes compressed and gzipped programs#
# in the current directory and turns them into bzip2#
# format.It handles the .tgz extension in a #
# reasonable way, producing a .tar.bz2 file.#
# #
#######################################################
$counter = 0;
$saved_bytes = 0;
$totals_file = "/tmp/machine_bzip2_total";
$machine_bzip2_total = 0;

while(<*[Zz]>) {
next if /^bzip2-0.1pl2.tar.gz$/;
push @files, $_;
}
$total = scalar(@files);

foreach (@files) {
if (/tgz$/) {
($new=$_) =~ s/tgz$/tar.bz2/;
} else {
($new=$_) =~ s/.g?z$/.bz2/i;
}
$orig_size = (stat $_)[7];
$counter;
print "Repacking $_ ($counter/$total)...n";
if ((system "gzip -cd $_ |bzip2 >$new") == 0) {
$new_size = (stat $new)[7];
$factor = int(100*$new_size/$orig_size .5);
$saved_bytes= $orig_size-$new_size;
print "$new is about $factor% of the size of $_. :",($factor<100)?")":"(","n";
unlink $_;
} else {
print "Arrgghh!Something happened to $_: $!n";
}
}
print "You"ve ",
($saved_bytes>=0)?"saved":"lost",
" $saved_bytes bytes of storage space :",
 ($saved_bytes>=0)?")":"(", "n";

unless (-e "/tmp/machine_bzip2_total") {
system ("echo "0" >/tmp/machine_bzip2_total");
system ("chmod", "0666", "/tmp/machine_bzip2_total");
}


chomp($machine_bzip2_total = `cat $totals_file`);
open TOTAL, ">$totals_file"
 or die "Can"t open system-wide total: $!";
$machine_bzip2_total= $saved_bytes;
print TOTAL $machine_bzip2_total;
close TOTAL;

print "That"s a machine-wide total of ",`cat $totals_file`," bytes saved.n";



--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

11. 中譯本
譯者注: 若您發(fā)現(xiàn)本文件內(nèi)容有翻譯不順暢或錯誤的地方,請您來信告訴我,以做更正,謝謝 。譯者電子郵件 linuxer.bbs@cis.nctu.edu.tw 或 linux4tw@geocities.com

譯注:這份 HOWTO 文件的中文版可在臺灣 Linux 使用者組織下的中文 Linux 文件計畫 http://www.linux.org.tw/CLDP/
或是"Linux for Taiwan 臺灣人的 Linux " http://members.xoom.com/linux4tw/ 下取得 。


--------------------------------------------------------------------------------

推薦閱讀