reading of Linux compressed files
· *. Z Compress program compressed file;
· *.BZ2 bzip2 program compressed files;
· *.GZ gzip program compressed file;
· The data packaged by the *.tar tar program has not been
PHP ZipArchive compressed files and download the packaged files. This article briefly introduces how to zip archive files in PHP and download the packaged files. for details about how to package php files, refer to section 5. Anal
files, the following for the TAR series of compressed files to make a summary:
1 for. Tar End of File
TAR-XF All.tar
2 for. GZ End of File
Gzip-d all.gzGunzip all.gz
3. Documents ending with. tgz or. tar.gz
Tar-xzf all.tar.gzTar-xzf all.tgz
4 for. bz2 End of File
Bzip2-d all.bz2BUNZIP2 all.bz2
5) For tar.bz2 end of file
TAR-XJF all.tar.bz2
6) for. File at the en
We are in the maintenance of Linux server, often encountered to view the contents of various formats of compressed files, here I picked a few common format files, record, easy to find later.1. tar format file tar tvf test.tar2, tar.gz format file TAR-ZTF test.tar.gz3, tar.bz2 format file TAR-JTF test.tar.bz24, zip format file
First go to FolderCd/home/ftp2/1520/webCompress method One : Compress 888.com website under WebZip-r 888.com.zip888.comcompression Method Two : All files and folders under the current directory are compressed into a myfile.zip file,-r indicates that all files under the recursive compression sub-directory.Zip-r myfile.zip./*ExtractUnzip-o-d/home/sunny Myfile.zipUn
Tags: Copyright file time strong subdirectory exists Linux command default source fileDirectory1. Introduction to Commands2. Common parameter Introduction3. Example4. Direct access to the bottomIntroduction to CommandsLike the zip command, gzip for file compression, gzip compressed file extension ". gz",gzip Delete source files after default compression . Gunzip is used to decompress
above knowledge, you should be able to unlock a variety of compressed files, the following for the TAR series of compressed files to make a summary:
1 for. Tar End of File
TAR-XF All.tar
2 for. GZ End of File
Gzip-d all.gz
Gunzip all.gz
3. Documents ending with. tgz or. tar.gz
Tar-xzf all.tar.gz
Tar-xzf all.tgz
4
ratioSyntax format: XZ option parameterCommon options:-D: Unzip-#-K: Preserve source files while compressing, or use output redirection to preserve source filesUNXZ: DecompressionXzcat: In the case of no pressure, view the contents of the XZ text file, with XzdecZip: Can be used to unzip a file, or to package a file. Zip is a widely used compression program that
(Fi_d)ElseGlobal FileCountGlobal ZipdirFileCount = FileCount + 1# Print FileCountFileName = Os.path.join (filepath,fi_d)Filenamenoext = Getfilenameandext (FileName) [0]Fileext = Getfilenameandext (FileName) [1]# If you want to save to the same folder, set the file name to emptyFilenamenoext = ""Zipdirdest = Zipdir + "/" + Filenamenoext + "/"If fileext in ['. zip ', '. rar ']:If not Os.path.isdir (zipdirdest):Os.mkdir (Zipdirdest)if Fileext = = ". Zip": #Print str (filecount) + "--" + fileName#
extension name is automatically appended to the package name.
# Unrar E All.rar
This command is to extract all the files in the All.rar
As of this, we have introduced the TAR, gzip, gunzip, bzip2, BUNZIP2, compress under Linux
, uncompress, zip, unzip, RAR, Unrar, and so on, you should already be able to use them for. Tar
,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. Z,. Tar. Z,. zip,. rar, 10 kinds of
ImportJava.io.BufferedInputStream; ImportJava.io.BufferedOutputStream; ImportJava.io.File; ImportJava.io.FileInputStream; Importjava.io.FileNotFoundException; ImportJava.io.FileOutputStream; Importjava.io.IOException; ImportJava.util.zip.ZipEntry; ImportJava.util.zip.ZipOutputStream; /*** Package The file below the folder * into a zip archive * *@authorHWT **/ Public classFiletozip {PrivateFiletozip () {}/*** The source files stored in the Sourcefil
backup file.-X releases the file from the archive file.3.2 Auxiliary Options:-B This option is set for the tape drive, followed by a number to indicate the size of the chunk, with a system preset value of 20x512 bytes.-F using a profile or device, this option is usually required.-K saves the file that already exists. For example, restoring a file, encountering the same file during the restore process, does not overwrite it.-M when restoring files, se
When Java.util.zip.ZipInputStream and Java.util.zip.ZipOutputStream compress and decompress a zip package with a Chinese name file, the following exception is reported:
Java.lang.IllegalArgumentExceptionAt Java.util.zip.ZipInputStream.getUTF8String (zipinputstream.java:293)At Java.util.zip.ZipInputStream.readLOC (zipinputstream.java:247)At Java.util.zip.ZipInputStream.getNextEntry (zipinputstream.java:74)At Com.test.ZipTest.unZipAssetSouce (ziptest.java:25)At Com.test.ZipTest.main (ziptest.java:
ending with. Z
Uncompress all. Z
72.16.tar. Z
Tar-xzf all.tar. Z
In addition, Linux also has corresponding methods to decompress the compressed file .zipand .rar under windows.Guys:
1)for. Zip
Linux provides zip and unzip programs, Zip is a compression program, and unzip is a decompression program. Their ParametersThere are many options. Here we will only give a
for-loop is to set a variable to each value in a list and repeat until the list is exhausted.
In this case, the for-loop calls the matching *.tar file name as a parameter repeatedly to execute the tar XF. So we'll extract the compressed file "automatically".
Another very common file format is zip. The command to extract the zip file is unzip. Here's the same problem:
In recent projects using Java to implement the Zip/unzip XML file functionality, Java comes with the API to facilitate the implementation of file compression and decompression, record the relevant code.
Zip source file to destination file with source file name
Public void Zip(file src, file dest) {InputStreaminch=NULL; Zipoutputstream zos=NULL;Try{Zos =NewZipoutputstream (NewFileOutputStream (dest)); ZipEntry ze=NewZipEntry (Src.getname
variable as a value in the list and repeats until the list is used up. Here, the for-loop uses the file name matching *. tar as a parameter to repeatedly call and execute tar xf. In this way, the compressed files are automatically extracted one by one. Another common file format is ZIP. The command to decompress the ZIP file is unzip. The same problem exists her
bzip2 .. The file ending with Z is the result of bzip2 compression. The decompress program relative to compress is uncompress. Use the-Z parameter in tar to call gzip. The following is an example:
# Tar-cZf all.tar. Z *. jpg
Forbidden. Z
# Tar-xZf all.tar. Z
This command is used to unbind the generated package.
With the above knowledge, you should be able to uncompress a variety of compressed files
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.