The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copy Compress as one command findprakash UNIX for Dummies Questions & Answers 10 03-08-2009 01:19 PM
mv and compress on the fly simquest UNIX for Dummies Questions & Answers 1 02-22-2007 12:51 PM
SSH Compress Commands kushti UNIX for Dummies Questions & Answers 2 08-13-2006 05:12 PM
tar and compress muru UNIX for Advanced & Expert Users 4 07-31-2006 08:23 PM
Compress and copy a Folder scorpiyanz UNIX for Advanced & Expert Users 1 08-19-2005 01:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 11-28-2005
here2learn here2learn is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 53
Copy and compress

Is there a way to copy a file and compress it at the same time?

I realize the file can be copied and then compressed, but I was wondering if it's possible to do it in a one-line command and for that matter, if it would be more efficient to perform the operation with a one-line command?

Thanks.
  #2 (permalink)  
Old 11-28-2005
jyoung jyoung is offline
Registered User
  
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 228
Maybe this link will help:
Backup single large file
  #3 (permalink)  
Old 11-29-2005
here2learn here2learn is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 53
Thanks JYOUNG. That allowed me to accomplish the task albeit not with a one-line command.

It appears that copying & gzipping thru a pipe isn't any faster than copying, gzipping & moving a 120MB file.

Guess I'll stick w/ the non-PIPE procedure.

Last edited by here2learn; 12-03-2005 at 06:59 PM..
  #4 (permalink)  
Old 11-29-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Not sure that you need a pipe, perhaps try...
Code:
gzip < /path/to/file1 > /path/to/file1.gz
  #5 (permalink)  
Old 11-30-2005
here2learn here2learn is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 53
That's what I was looking for !! MAN, for the life of me, I can't believe I didn't remember that option. Bet I won't forget it next time.

It seems the the times are approximately the same for all three methods, however Ygor's method does provide the one-line code I was looking for and prevents having to remove any named-pipe.

Thanks Ygor !!
  #6 (permalink)  
Old 03-08-2009
ezjay ezjay is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 2
copy and compress without itermediate files

To compress:

Code:
tar cf - <space_separated_list_of_files/folders> | gzip -c - > <path>/<archive_name>.tar.gz
To uncompress:

cd to the directory you want the files extracted in and run:

Code:
gunzip -c <path>/<archive_name>.tar.gz | tar xf -
(On Solaris, be sure to add the option E to the tar creation command arguments. i.e. tar cEf ...)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0