Unix/Linux Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Hpux find tar gzip

HP-UX


Tags
find tar gzip

Closed    
 
Thread Tools Search this Thread Display Modes
    #15  
Old Unix and Linux 08-08-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 24 April 2017, 3:44 PM EDT
Posts: 16
Thanks: 17
Thanked 0 Times in 0 Posts
First,
Thanks to all to take times to answer me.

I tried all commands that I received and only one works properly for me. (at least, a GZIP file is created.) I will verify the contains.

Below the 3 tests that I did :

test 1 ==> seems to work well

Code:
find * -type f -mtime -100 -exec tar cf - {} + | gzip > $MAITUT/BCK_DATA.tar.gz

Result :
Code:
-rw-rw-r-- 1 maitdev mait 290757296 Aug 8 09:04 BCK_DATA.tar.gz


Code:
find * -type f -mtime -2 -exec tar cf - {} + | gzip > $MAITUT/BCK_DATA.tar.gz

result :
Code:
-rw-rw-r-- 1 maitdev mait 7876 Aug 8 09:12 BCK_DATA.tar.gz

test 2

Code:
find * -type f -mtime -900 -print | tar -cvf - | gzip > $MAITUT/BCK_DATA.tar.gz

Result :
Code:
Attempt to create archive of no files. Nothing dumped.

test 3

Code:
find * -type f -mtime -900 -print -exec tar cvf {} \; && bzip2 *.tar

result :
Code:
4fa056a8
Attempt to create archive of no files. Nothing dumped.
ARCNEWLD.dat
Attempt to create archive of no files. Nothing dumped.
ARCNEWLD.idx
Attempt to create archive of no files. Nothing dumped.
ARCNEWLD.sfd

etc.. same error on each files reported.

again, thanks to all

Last edited by rbatte1; 08-09-2016 at 03:33 AM.. Reason: Guessed at CODE tags
Sponsored Links
    #16  
Old Unix and Linux 08-08-2016
stomp stomp is offline
Registered User
 
Join Date: May 2016
Last Activity: 25 September 2017, 12:49 PM EDT
Posts: 191
Thanks: 10
Thanked 66 Times in 61 Posts

Code:
 find * -type f -mtime -100 -exec tar cf - {} + | gzip > $MAITUT/BCK_DATA.tar.gz

As stated from others here: The above command will break when there are too many files found.

This is an alternative with cpio:

Backup


Code:
find * -type f -mtime -100 | cpio -o --format=crc | gzip >file.cpio.gz

Examine


Code:
gzip -dc file.cpio.gz | cpio -itv

Restore


Code:
gzip -dc file.cpio.gz | cpio -i --make-directories

The Following User Says Thank You to stomp For This Useful Post:
royinfo.alain (08-08-2016)
Sponsored Links
    #17  
Old Unix and Linux 08-08-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 24 April 2017, 3:44 PM EDT
Posts: 16
Thanks: 17
Thanked 0 Times in 0 Posts
I just tried the new command above and got the error :


Code:
find * -type f -mtime -100 | cpio -o --format=crc | gzip >file.cpio.gz
  
cpio: illegal option -- -
cpio: illegal option -- =
Usage: cpio -o[aAcBvxCh] [-e warn|force|ignore] <name-list >collection
       cpio -i[BcdmPrtuvfsSbx6RU] [pattern ...] <collection
       cpio -p[adlmruvxU] [-e warn|force|ignore] directory <name-list


Moderator's Comments:
Hpux  find tar gzip
Please use CODE tags for all code, files, input & output/errors.
It makes it far easier to read and preserves multiple spaces for indenting or fixed-width data.

Last edited by rbatte1; 08-08-2016 at 11:51 AM.. Reason: Added CODE tags
    #18  
Old Unix and Linux 08-08-2016
stomp stomp is offline
Registered User
 
Join Date: May 2016
Last Activity: 25 September 2017, 12:49 PM EDT
Posts: 191
Thanks: 10
Thanked 66 Times in 61 Posts
ok. Seems your cpio does not understand --format=crc. Just leave that option out. --make-directories is not understood either.

Last edited by stomp; 08-08-2016 at 03:58 PM..
The Following User Says Thank You to stomp For This Useful Post:
royinfo.alain (08-08-2016)
Sponsored Links
    #19  
Old Unix and Linux 08-08-2016
drl's Unix or Linux Image
drl drl is online now Forum Advisor  
Registered Voter
 
Join Date: Apr 2007
Last Activity: 25 September 2017, 6:02 PM EDT
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,171
Thanks: 221
Thanked 401 Times in 346 Posts
Hi.

On a system I sometimes use:

Code:
OS, ker|rel, machine: HP-UX, B.11.11, 9000/785
Distribution        : GenericSysName [HP Release B.11.11] (see /etc/issue)
/bin/tar - ( /bin/tar May 23 2007 )
/usr/bin/tar - ( /usr/bin/tar May 23 2007 )
/usr/local/bin/tar tar (GNU tar) 1.26

I see that GNU tar is available in /usr/local/bin.

It may be worthwhile to see if GNU tar is available on your system.

Best wishes ... cheers, drl
The Following User Says Thank You to drl For This Useful Post:
royinfo.alain (08-08-2016)
Sponsored Links
    #20  
Old Unix and Linux 08-08-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 24 April 2017, 3:44 PM EDT
Posts: 16
Thanks: 17
Thanked 0 Times in 0 Posts
Thank you so much everyone.

I used the command below and works fine.

code :

Code:
find * -type f -mtime -$nb_days | cpio -o | gzip >$MAITUT/BCK_DATA.cpio.gz

to extract :

Code:
gzip -dc $MAITUT/BCK_DATA.cpio.gz  | cpio -imd




Moderator's Comments:
Hpux  find tar gzip Please use CODE tags as required by forum rules!

Last edited by RudiC; 08-08-2016 at 02:38 PM.. Reason: Added CODE tags.
Sponsored Links
    #21  
Old Unix and Linux 08-13-2016
rezasadeghi rezasadeghi is offline
Registered User
 
Join Date: Dec 2015
Last Activity: 17 June 2017, 6:14 AM EDT
Posts: 12
Thanks: 1
Thanked 2 Times in 2 Posts
hi,
i want to correct my command .

Code:
find * -type f -mtime -900 -print -exec tar cvs  name.tar {} \; && bzip2 *.tar

i am sure this will work

Last edited by Don Cragun; 08-13-2016 at 07:17 AM.. Reason: Add CODE tags.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help ASAP - FIND - TAR - GZIP royinfo.alain UNIX for Beginners Questions & Answers 2 08-04-2016 04:46 PM
Failed to use find-tar-gzip together Chetanz UNIX for Dummies Questions & Answers 7 02-01-2013 04:23 PM
find + tar + gzip + uunecode/email --> in one command? kchinnam Shell Programming and Scripting 3 03-02-2012 02:25 PM
tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file ahSher UNIX for Dummies Questions & Answers 2 04-02-2009 04:43 AM
From HPUX tar to Linux tar iarot Filesystems, Disks and Memory 4 02-14-2002 03:10 AM



All times are GMT -4. The time now is 06:13 PM.