Re: question of tar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cjzjm100 wrote:
> Hi ,guys!
> I had used the command:tar -N '2008/04/13' -zcvf test1.tar.gz . to
> package some files. there are some files modified before 2008/04/13 in
> the currently directory,but why they are in the test1.tar.gz too?

While looking at the tar man page, I see the following:

>        -N, --after-date DATE, --newer DATE
>               only store files newer than DATE
> 
>        --newer-mtime DATE
>               like --newer, but with a DATE

I didn't like the explanation, so I looked at the info file for tar:

> `--after-date=DATE'
> `--newer=DATE'
> `-N DATE'
>      Only store files newer than DATE.
> 
>      Acts on files only if their modification or inode-changed times are
>      later than DATE.  Use in conjunction with any operation.
> 
>      If DATE starts with `/' or `.', it is taken to be a file name; the
>      last-modified time of that file is used as the date.
> 
> `--newer-mtime=DATE'
>      Acts like `--after-date=DATE' (`--newer=DATE', `-N DATE'), but
>      only looks at modification times.
> 
>    These options limit `tar' to only operating on files which have been
> modified after the date specified.  A file is considered to have
> changed if the contents have been modified, or if the owner,
> permissions, and so forth, have been changed.  (For more information on
> how to specify a date, see *Note Date input formats::; remember that the
> entire date argument must be quoted if it contains any spaces.)
> 
>    Gurus would say that `--after-date=DATE' (`--newer=DATE', `-N DATE')
> tests both the `mtime' (time the contents of the file were last
> modified) and `ctime' (time the file's status was last changed: owner,
> permissions, etc) fields, while `--newer-mtime=DATE' tests only `mtime'
> field.
> 
>    To be precise, `--after-date=DATE' (`--newer=DATE', `-N DATE')
> checks _both_ `mtime' and `ctime' and processes the file if either one
> is more recent than DATE, while `--newer-mtime=DATE' only checks
> `mtime' and disregards `ctime'.  Neither uses `atime' (the last time the
> contents of the file were looked at).

Based on this explantation, it begs the question:

Does it work for you with --newer-mtime=DATE rather than -N DATE which
doesn't do what you want?

> Here ware what i did:
> [cjzjm100@localhost test1]$ ll
> total 28
> drwxr-xr-x 4 cjzjm100 cjzjm100 4096 04-13 19:18 2
> -rw-r--r-- 1 cjzjm100 cjzjm100 0 04-10 20:57 hello
> -rw-r--r-- 1 cjzjm100 cjzjm100 0 04-01 00:00 hello1
> -rw-r--r-- 1 cjzjm100 cjzjm100 0 04-10 21:18 hello2
> drwxr--r-- 2 cjzjm100 cjzjm100 4096 04-13 17:11 testing
> [cjzjm100@localhost test1]$ rm -r 2
> [cjzjm100@localhost test1]$ tar -N '2008/04/13' -zcvf test1.tar.gz .
> tar: Treating date `2008/04/13' as 2008-04-13 00:00:00 + 0 nanoseconds
> ./
> ./testing/
> ./testing/hello.c
> ./testing/hello2.c
> ./testing/hello
> ./hello1
> ./test1.tar.gz
> ./hello2
> ./hello
> why the files modified before 2008/04/13 like hello were also in the
> package?
> there is a file named test1.tar.gz in the test1.tar.gz,why?
> 
> Reply With Quote
> 
> 


-- 
Kevin J. Cummings
kjchome@xxxxxxx
cummings@xxxxxxxxxxxxxxxxxx
cummings@xxxxxxxxxxxxxxxxxxxxxxx
Registered Linux User #1232 (http://counter.li.org)

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux