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-09-2009, 10:46 PM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,462
Blog Entries: 6

Rep: Reputation: 51
Compressing tool in Linux..


Any application tool in Linux which will scan the thousands of files and compress those who are not used for more than n no. of days
 
Old 07-09-2009, 11:34 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,274

Rep: Reputation: 148Reputation: 148
yes....
#find . -type f -atime +30 | xargs tar czvf name.tar.gz
OR
tar -czvf name.tar.gz `find . -type f -atime +30`

here you are executing these on current directory
-atime --> file was last accessed n*24 hours ago
 
Old 07-10-2009, 04:34 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
Quote:
Originally Posted by kirukan View Post
yes....
#find . -type f -atime +30 | xargs tar czvf name.tar.gz
OR
tar -czvf name.tar.gz `find . -type f -atime +30`

here you are executing these on current directory
-atime --> file was last accessed n*24 hours ago
I agree with your solution, but I would do it this way:

Code:
find . -type f -atime +30 -print0 | xargs -0 gzip
the -print0 and -0 use null terminators to handle spaces in file names (otherwise it would cause major problems), and I figure since we are looking for files and not directories it's better just to use gzip.

Also make sure you know what you want:
Code:
       -atime n
              File  was  last  accessed n*24 hours ago.  When find figures out
              how many 24-hour periods ago the file  was  last  accessed,  any
              fractional part is ignored, so to match -atime +1, a file has to
              have been accessed at least two days ago.

       -ctime n
              File's status was last changed n*24 hours ago.  See the comments
              for -atime to understand how rounding affects the interpretation
              of file status change times.

       -mtime n
              File's  data was last modified n*24 hours ago.  See the comments
              for -atime to understand how rounding affects the interpretation
              of file modification times.

Last edited by H_TeXMeX_H; 07-10-2009 at 04:37 AM.
 
  


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
Compressing libraries mattireland Linux - Desktop 4 04-04-2008 07:07 AM
Compressing printing between Linux and Windoz Desktop Printers using a filter jeager Linux - Newbie 0 04-10-2007 12:24 PM
DVD Shrink 3.2 an compressing dvds in linux kurrupt Linux - Software 1 10-14-2004 06:13 PM
Compressing files GtkUser Linux - Software 1 04-02-2003 06:21 AM
URLSCAN tool MS = Linux tool ? OB1 Linux - Security 3 10-05-2002 12:58 AM


All times are GMT -5. The time now is 11:53 PM.

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