LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2005, 04:30 PM   #1
Wha?Where?
LQ Newbie
 
Registered: Jul 2005
Posts: 19

Rep: Reputation: 0
Compressing/Zipping A Directory


I am VERY new to linux - have only installed Fedora 4 times - and should have only been twice but i couldnt figure out how to do something so i reinstalled it from scratch

Anyway. I have a directory called MyDir in /usr/local/share and I want to zip it up every day with the day being the name of the file like:

07072005.zip

I have this working great in window$ but really want to get it right in Linux.

I have the dir being tarred successfully but cant figure out how to name it for the day that its being zipped.

Thanks.
 
Old 07-07-2005, 04:33 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
tar czf `date +%Y%m%d`.tar.gz /usr/local/share


Cheers,
Tink
 
Old 07-07-2005, 10:03 PM   #3
Wha?Where?
LQ Newbie
 
Registered: Jul 2005
Posts: 19

Original Poster
Rep: Reputation: 0
That worked like a charm - THANK YOU!!! A follow up question does tar and gzip not compress files as much as winzip? seems like my previous (windows versions were about 18MB and these are about 24MB)
 
Old 07-07-2005, 10:07 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
What file-type is it?

If you want MAXIMUM compression use

bz2 instead of gzip - it's just a tad slower.

tar cjf `date +%Y%m%d`.tar.bz2 /usr/local/share



Cheers,
Tink
 
Old 07-07-2005, 10:20 PM   #5
Wha?Where?
LQ Newbie
 
Registered: Jul 2005
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks again! That made a big difference.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with compressing a directory for backup Lleb_KCir Linux - Newbie 8 10-28-2005 03:52 AM
strange problem while compressing a directory kartheekpn Linux - General 5 08-04-2005 01:39 PM
Compressing directory with bzip2 Haiyadragon Linux - Newbie 1 06-22-2005 06:13 PM
zipping/compressing folders and files DiZASTiX Linux - Newbie 1 05-26-2003 09:48 PM
Zipping and Taring and ? Goatdemon Linux - Newbie 3 05-22-2002 08:17 AM


All times are GMT -5. The time now is 06:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration