Results 1 to 10 of 10
Hi,
I can't make tar to use properly the --newer option.
I explain :
I would like tar to tar files newer than another one.
/bin/tar --newer refFile -cf tarFile.tar ...
- 06-05-2007 #1Just Joined!
- Join Date
- Oct 2006
- Posts
- 29
tar --newer seems not working as expected.
Hi,
I can't make tar to use properly the --newer option.
I explain :
I would like tar to tar files newer than another one.
/bin/tar --newer refFile -cf tarFile.tar .
But a lot of files OLDER than refFile are in the tar file. I wonder if this doesn't come from english/french date display (but it works with find -newer command).
For ex, the file xsdlib.jar is in the tar file :
/home/eric/softs/local 146 # date
mar jun 5 16:42:26 CEST 2007
/home/eric/softs/local 146 # ls -als xsdlib.jar
1 -rw-r--r-- eric/users 476097 2006-06-08 21:09 xsdlib.jar
my refFile :
/home/eric/softs/local 149 # ls -als file_weekly
1 -rwxrw-r-- 1 root users 57 mai 21 12:58 file_weekly
refFile is from May 21 2007
xsdlib.jar file is from June 08 2006 (older than refFile)
This file should NOT be in the tar file.
Can you help me to solve this problem ?
Regards.
Eric.
- 06-05-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Try:
RegardsCode:/bin/tar --newer="`date -r refFile`" -cf tarFile.tar
- 06-06-2007 #3Just Joined!
- Join Date
- Oct 2006
- Posts
- 29
Hi,
This does not work.
/bin/tar --newer "lun mai 21 12:58:04 CEST 2007" -c -j -X excludeList -f sauv_06_06_2007.tbz2 /etc /home/eric
/bin/tar: Substitution de 1901-12-13 20:55 pour un format inconnu de date `lun mai 21 12:58:04 CEST 2007'
Which means : Unknown date format 'lun mai 21 12:58:04 CEST 2007' replaced by 1901-12-13 20:55.
If I use :
/bin/tar --newer 2007-05-21...
I do not have an error message but the tar archive contains old files.
Regards.
Eric.
- 06-06-2007 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
The syntax is:
Code:tar --newer=
Regards
- 06-06-2007 #5Just Joined!
- Join Date
- Oct 2006
- Posts
- 29
Hi,
It does not change anything. It seems that the problem is the date format.
Regards.
Eric.
- 06-06-2007 #6Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Probably your version of tar don't support this option.
Try find, it should be something like:
RegardsCode:find * -newer refFile -print -exec /bin/tar -cf tarFile.tar {} \;
- 06-07-2007 #7Just Joined!
- Join Date
- Oct 2006
- Posts
- 29
Hi,
Yes, this is something I was thinking about.
But I'll try to see if it does not work at all (I use the --newer option or not and the results are exactly the same) or if there is a small difference which could come from something related with modification time and access time.
Regards.
Eric.
- 06-07-2007 #8Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
The option is -newer not --newer.
Regards
- 06-08-2007 #9Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
using GNU tar: try with quotes around DATE, thus:
/bin/tar --newer "2007-05-21" ...
that works OK on my system (debian 3.1)the sun is new every day (heraclitus)
- 06-09-2007 #10Just Joined!
- Join Date
- Oct 2006
- Posts
- 29
Hi,
My tar command accepts -N, --newer= and --after-date= options (and obviously some others).
I did not succeed to make the --newer option works BUT --newer-mtime WORKS.
I don't understand the reason why the first one fails because the difference between the 2 is that --newer checks for both modification time and inode modification while the second checks only for file modification time (see GNU tar).
To my point of view, the files I wanted to be excluded from the archive were not changed at all after the reference date. I am probably wrong.
Anyway, I found an acceptable workaround and I thank all people how helped me.
Regards.
Eric Bouyoux.


Reply With Quote