LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-02-2008, 05:01 PM   #1
m0loch
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
archiving only new/updated files


so I have a website and the weekly tar.gz archive of everything is in the 25MB range. My preference is to have cron email me the archive file, but of course that attachment size is too big for gmail and I really don't want attachments that size in my email anyhow.

so suppose I back up today, grab a copy of the archive and then next week compare new files in the filesystem to files in the archive and make a new archive containing only files that are new or have been updated since last week? Is there some way to make tar --diff do this (doesn't seem to like new directories on the filesystem) or create a backup-this-week.tar.gz and compare it with diff to backup-last-week.tar.gz and somehow build a new archive of just the difference?

I've started building a script that uses rsync* with --list-only to create a list and then diff to compare a last week list vs. this week list, extract the names of newer files and send those file names to tar - but it's long and tedious and I just know there has to be an easier way, though the learning experience of building a script like this is good stuff for me...anyhow help?


*would use ls instead of rsync, but I don't know how to make it output full paths is listing recursively..
 
Old 08-02-2008, 05:40 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Hi.

You can create a tar containing only the file which have been modified in the last week with:
Code:
find /path/to/website -type f -mtime -7 -print0 | xargs -0 tar cvzf week.tar.gz
Dave

Last edited by ilikejam; 08-02-2008 at 05:58 PM. Reason: Command change
 
Old 08-02-2008, 06:14 PM   #3
m0loch
LQ Newbie
 
Registered: May 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Perfect! thanks so much..

Quote:
Originally Posted by ilikejam View Post
Hi.

You can create a tar containing only the file which have been modified in the last week with:
Code:
find /path/to/website -type f -mtime -7 -print0 | xargs -0 tar cvzf week.tar.gz
Dave
 
  


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
archiving files in c++ mkrems Programming 2 04-03-2008 10:18 PM
Archiving files using a time stamp. HunterColt22 Programming 3 06-11-2007 02:29 AM
archiving rotated log files tjainsworth Linux - Security 4 07-12-2006 02:00 PM
Archiving Email Files ? dolphans1 Mandriva 6 06-15-2005 11:12 AM
What archiving app for Linux will do multiple files of the same name from X? t3gah Linux - Software 3 03-19-2005 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:09 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
Open Source Consulting | Domain Registration