LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-08-2011, 11:27 AM   #1
carwe
LQ Newbie
 
Registered: Aug 2011
Posts: 17

Rep: Reputation: Disabled
Problem getting tar only to add new files


Hi,

I'm trying to make 'tar' only add files after a certain date for a backup purpose. However, it doesn't do what I want:

Code:
$ tar --after-date=2011-07-03 -c -v -z -f ../arch.tar.gz .
tar: Option --after-date: Treating date `2011-07-03' as 2011-07-03 00:00:00
./
./someFile
./someOtherFile
[...]
$ ll someFile
-rwxrwxrwx 2 root root 16896 2009-02-07 18:12 someFile
$
I'm using --after-date, the short for this option is -N.

The warning for --after-date shows that the program really identifies the option and the date.

...so, even though the date of someFile is before my specified date, it is added to the archive. Why?

(The disk I'm running this on has a NTFS file system. And yes, I would need to run this on that partition without copying the files to an ext partition first. Should be possible, and I don't think that's the problem, just wanted to mention it.)

Tanks,
Carl
 
Old 11-08-2011, 12:38 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
I don't know if -N option works when creating an archive

As workaround, I would try:

Code:
touch -d "2011-07-03 00:00:00" /tmp/date_marker
find ./* -newer /tmp/date_marker | xargs tar czvf ../arch.tar.gz
rm /tmp/date_marker
 
Old 11-09-2011, 06:25 AM   #3
carwe
LQ Newbie
 
Registered: Aug 2011
Posts: 17

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestion. I'll try it, however, isn't there a way to do this with tar options? Adding files to an archive with modification date later than a defined date seems like a very basic thing to be able to do if you want to create archives for back-up purposes. Or is there any other archive/compression utility in Linux that can do this?
 
Old 11-09-2011, 06:41 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Maybe use --newer-mtime option instead of --after-date ?

See:
http://www.gnu.org/s/tar/manual/html_section/after.html
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
problem when dealing with tar.gz files on ubuntu mbg_gayed Linux - Software 10 08-15-2009 06:45 AM
tar -k --keep-old-files extraction problem somae Linux - Software 8 02-27-2009 02:51 PM
Piping tar bzcat to add a file to a tar.bz2 archive DaveQB Linux - Software 0 06-02-2008 08:28 PM
Problem installing tar.gz files in SUSE 10.0 dc11 Linux - Software 5 02-06-2006 05:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:42 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