Sponsored Content
Full Discussion: Hpux find tar gzip
Operating Systems HP-UX Hpux find tar gzip Post 302978915 by MadeInGermany on Friday 5th of August 2016 01:10:43 PM
Old 08-05-2016
Code:
find * -type f -mtime -$nb_days -print | xargs tar cf - | gzip > $MAITUT/BCK_DATA.tar.gz

Maybe the following works as well (and handles special characters in filenames better)
Code:
find * -type f -mtime -$nb_days -exec tar cf - {} + | gzip > $MAITUT/BCK_DATA.tar.gz

Both methods will fail if there are too many files: a second tar is invoked that certainly obscures the tar file.
This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

From HPUX tar to Linux tar

Dear sirs, I have some 4mm dat cartridges (4GB) made in a HP-UX 11.00 with a standard tar command (tar -cv files_to_backup) made with a scsi dat drive HP 35470A. After more than one year I need to restore some data on a linux system (Red Hat 7.2) which has the same dat drive. Now I tried... (4 Replies)
Discussion started by: iarot
4 Replies

2. UNIX for Dummies Questions & Answers

TAR and GZIP help

Hi, There are 700 .pdf files in a certain directory on the server and I need to TAR them first and then compress them using GZIP to free up the space. The combined size of the .pdf files is 3gb. However, there is only 1gb of free space on the server. So as you can see when I try to TAR these... (3 Replies)
Discussion started by: VandeMatram
3 Replies

3. UNIX for Advanced & Expert Users

tar/gzip/gz...which one to use?

P0251WLADC.svm_wl1 > /svm_wl1/billing/data/server/archive/ALLEVT $ du -k FEB2006 22050224 FEB2006 As you can see,i have a folder called "FEB2006" which is around 22 GB. i guess zip or compress wont work...( i don know how do we compress a folder) i wished to use ""tar" ( i suppose... (5 Replies)
Discussion started by: abhijeetkul
5 Replies

4. UNIX for Dummies Questions & Answers

tar and gzip

Hi, I would like to have a combined gzip and tar that will compress and create multiple output tar.gz files. I want to have multiple files output because i cannot create an archive because there is no more space on my harddisk. I cannot transfer it locally because of slow connection. I want to... (3 Replies)
Discussion started by: tungaw2004
3 Replies

5. Shell Programming and Scripting

tar + gzip + split together

Hi All I need guidance on this requirement . We have a directory structure which has data of approx 100 GB We need to tar the structure then zip it and create different files of not more than 10 GB A separate tar file then a .gz should not be created , on the fly a script is needed... (7 Replies)
Discussion started by: aamir1234
7 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. Shell Programming and Scripting

find + tar + gzip + uunecode/email --> in one command?

How to search for all files with matching strings --> find + tar + gzip + uunecode/email them in one command? I am sure there is a right way to pass list of files to tar, then compress tar file. Then send that as attachment using uuencode in one command.. Can we do that!? (3 Replies)
Discussion started by: kchinnam
3 Replies

8. Shell Programming and Scripting

tar and gzip files

Hi Guys, I am using RHEL5 and Solaris 9 & 10. I want to tar and gzip my files then remove them after a successful tar command... Lets say I have files with extension .arc then I want to tar and gzip these files. After successful tar command I want to remove all these files (i.e .arc). ... (3 Replies)
Discussion started by: Phuti
3 Replies

9. UNIX for Dummies Questions & Answers

Failed to use find-tar-gzip together

Hello I am trying to select multiple files older than 14 days and create a single compressed file out of it. (AIX Release 3 Version 5) I am trying to achieve it by following tar -cvf db01_log.tar `find . -name "db01*.log" -mtime +14" -print`| gzip > db01_log.tar however it just... (7 Replies)
Discussion started by: Chetanz
7 Replies

10. UNIX for Beginners Questions & Answers

Need help ASAP - FIND - TAR - GZIP

Hi, I need to combined in 1 line the execution below : find * -type f -mtime -$nb_days -print | xargs tar -cvf $MAITUT/BCK_DATA.tar gzip $MAITUT/BCK_DATA.tar.gz The fact that the TAR is very big, at the end I need to generate only the GZ file. The option z on the tar... (2 Replies)
Discussion started by: royinfo.alain
2 Replies
gzip(1) 						      General Commands Manual							   gzip(1)

NAME
gzip, gunzip, gzcat - Compresses or expands files. SYNOPSIS
gzip [-acdfhlLnNrtvV19] [-S suffix] [name...] gunzip [-acfhlLnNrtvV] [-S suffix] [name...] gzcat [-afhlLnNrtvV] [-S suffix] [name...] OPTIONS
Specifies ascii text mode; converts end-of-line using local conventions. This option is supported only on some nonUnix systems. For MSDOS, CR LF is converted to LF when compressing, and LF is converted to CR LF when decompressing. Writes output on standard output; keeps origi- nal files unchanged. If there are several input files, the output consists of a sequence of independently compressed members. To obtain better compression, concatenate all input files before compressing them. The gzcat command is equivalent to the gunzip -c or gzip -cd command. Specifies an uncompress operation. The gunzip command is equivalent to the gzip -d command. Force compression or decompression even if the file has multiple links or the corresponding file already exists, or if the compressed data is read from or written to a terminal. If the input data is not in a format recognized by the gzip command, and if the -c option is also specified, copy the input data without change to the standard output; that is, let the gzcat command behave as the cat command. If the -f option is not specified, and when not running in the background, the gzip command prompts to verify whether an existing file should be overwritten. Displays a help screen and quits. Lists the following fields for each compressed file: Specifies size of the compressed file. Specifies size of the uncompressed file. Specifies compression ratio (or 0.0% if unknown). Specifies the name of the uncompressed file. The uncompressed size is given as -1 for files that are not in the gzip format, such as compressed files. When used with the -v option, the following fields are also displayed: Specifies compression method. Specifies the 32-bit CRC of the uncompressed data. Specifies the time stamp for the uncompressed file. The compression methods currently supported are deflate, compress, lzh (SCO compress -H) and pack. The crc value is given as ffffffff for a file that is not in the gzip format. When used with the -N option, the uncompressed name and the date and time are those stored within the compressed file, if present. When used with the -v option, the size totals and compression ratio for all files is also displayed, unless some sizes are unknown. When the -q option is specified, the title and totals lines are not displayed. Displays the gzip license and quits. Specifies that the original file name and time stamp are not saved when compressing by default. (The original name is always saved if the name had to be truncated.) When decompressing, do not restore the original file name if present (remove only the gzip suffix from the com- pressed file name) and do not restore the original time stamp if present (copy it from the compressed file). This option is the default when decompressing. Specifies, when compressing, to always save the original file name and time stamp; this is the default. Specifies, when decompressing, to restore the original file name and time stamp, if present. This option is useful on sys- tems which have a limit on the length of a file name or when the time stamp has been lost after a file transfer. Suppresses all warnings. Travels the directory structure recursively. If any of the file names specified on the command line are directories, the gzip command descends into the directory and compresses all the files it finds there (or decompresses them in the case of the gunzip command). Uses the suffix instead of and should be avoided to remove confusion when files are transferred to other systems. A null suffix forces the gunzip command to attempt decompressing all given files regardless of the suffix, as follows: gunzip -S * (*.* for MSDOS) Previous versions of the gzip command used the suffix. This was changed to avoid a conflict with the pack command. Specifies that the compressed file's integrity be tested. Specifies verbose mode. Displays the name and percentage reduction for each file com- pressed or decompressed. Specifies the version number and compilation options and then quits. Regulates the speed of compression by using the specified digit #, for which -1 or --fast indicates the fastest compression method (less compression) and -9 or --best indicates the slowest compression method (best compression). The default compression level is -6 (that is, biased towards high com- pression at the expense of speed). DESCRIPTION
The gzip command reduces the size of specified files using the Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension modes, access and modification times. If files are not specified, or if a file name is "-", the standard input is compressed to the standard output. The gzip command only attempts to compress regular files. In particular, it ignores symbolic links. By default, the gzip command keeps the original file name and time stamp in the compressed file. These are used when decompressing the file with the -N option. This is useful when the compressed file name was truncated or when the time stamp was not preserved after a file transfer. Compressed files can be restored to their original form using the gzip command with the -d option, or by using the gunzip command. The gunzip command takes a list of specified files and replaces each file that begins with the correct magic number and whose name ends with -gz, -z, _z or with an uncompressed file without the original extension. The gunzip command also recognizes the special extensions and as shorthands for and respectively. When compressing, the gzip command uses the extension if necessary instead of truncating a file with a extension. The gunzip command can currently decompress files that are created by the gzip, zip, compress, compress -H or pack commands. The detection of the input format is automatic. When using the first two formats, the gunzip command checks a 32-bit CRC. For the pack command, the gun- zip command checks the uncompressed length. Although the standard compress format was not designed to allow consistency checks, the gunzip command is sometimes able to detect a bad file in cases where the uncompress command does not. Therefore, if you get an error when uncom- pressing a file, do not assume that the file is correct if the same file can be decompressed without error by the uncompress command. In this case, the uncompress command probably did not process the input file correctly, and the generated output file is not useful. The gzip command uses the Lempel-Ziv algorithm used in the zip and PKZIP commands. The amount of compression obtained depends on the size of the input and the distribution of common substrings. Typically, text such as source code or English is reduced by 60-70%. Compression is generally much better than that achieved by LZW (as used in the compress command), Huffman coding (as used in the pack command), or adaptive Huffman coding (in the compact command). Compression is always performed, even if the compressed file is slightly larger than the original. The worst case expansion is a few bytes for the gzip file header, plus 5 bytes every 32K block, or an expansion ratio of 0.015% for large files. Note that the actual number of used disk blocks almost never increases. The gzip command preserves the mode, ownership and time stamps of files when compressing or decompressing. Advanced Usage Multiple compressed files can be concatenated. In this case, the gunzip command extracts all members at once. For example: gzip -c file1 > foo.gz gzip -c file2 >> foo.gz Using the previous example, gunzip -c foo is equivalent to cat file1 file2. In case a member of a file is damaged, other members can still be recovered (if the damaged member is removed). However, you gain better compression by compressing all members at once as follows: cat file1 file2 | gzip > foo.gz The preceding command line compresses better than the following one: gzip -c file1 file2 > foo.gz If you want to recompress concatenated files to gain better compression, do the following: gzip -cd old.gz | gzip > new.gz If a compressed file consists of several members, the uncompressed size and CRC reported by the -l option applies to the last member only. If you need the uncompressed size for all members, use the following command: gzip -cd file.gz | wc -c To create a single archive file with multiple members so that members can later be extracted independently, use an archiver such as the tar or zip commands. GNU tar supports the -z option to invoke the gzip command transparently. The gzip command is designed as a complement to the tar command, not as a replacement. Environment The environment variable GZIP can hold a set of default options for the gzip command. These options are interpreted first and can be over- written by explicit command line options as follows. GZIP="-8v --name"; export GZIP (for sh) setenv GZIP "-8v --name" (for csh) RESTRICTIONS
When writing compressed data to a tape, it is generally necessary to pad the output with zeroes up to a block boundary. When the data is read and the whole block is passed to the gunzip command for decompression, the gunzip command detects that there is extra trailing garbage after the compressed data and emits a warning by default. You have to use the -q option to suppress warnings. This option can be set in the GZIP environment variable as follows: GZIP="-q" tar -xfz --block-compress /dev/tape/tape0_d1 (for sh) (setenv GZIP -q; tar -xfz --block-compr /dev/tape/tape0_d1 (for csh) In the previous example, the gzip command is invoked implicitly by the -z option of the GNU tar command. Make sure that the same block size (specified by the -b option of the tar command) is used for reading and writing compressed data on tapes. (This example assumes that you are using the GNU version of the tar command.) The --list flag reports incorrect sizes if they exceed 2 gigabytes. The --list flag reports sizes as -1 and crc as ffffffff if the com- pressed file is on a nonseekable media. In rare cases, the --best flag gives worse compression than the default compression level (-6). On some highly redundant files, the com- press command compresses better than gzip command. [Tru64 UNIX] The gzip command may not preserve the extended file attributes (property list) of a file, including any access control lists (ACL). Verify that any ACLs are not removed or modified by using gzip. EXIT STATUS
Success. An error occurred. A warning is encountered. SEE ALSO
Commands: compress(1), pack(1) Files: acl(4) gzip(1)
All times are GMT -4. The time now is 05:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy