Thursday, March 12, 2009

Yummy, Delicious, tar

Create an archive, based on date. The man page says use:
-N, --after-date DATE, --newer DATE
But what's the format for date? Further, if you try:
tar -czvf --newer "11 Mar 2009" www-incr-0311.tar.gz \
    www
...it creates a bogus file, --newer, which is a bear to delete.

(Try it. Frustration is good for the soul. The trick is to use the absolute path to file.)

Turns out, with tar, the dash-dash options must go at the end of the command line:
tar czvf www-incr-0311.tar.gz www \
    --newer "11 Mar 2009"
As for the date format, I decided to use mtime and an all numeric format:
tar -czvf www-incr-0311.tar.gz www \
    --newer-mtime "20090301"

1 comment:

  1. Most of commands have the -- option to remove bogus files :

    rm -- --newer

    ReplyDelete