![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| format the extracted data | kmanivan82 | Shell Programming and Scripting | 2 | 10-15-2008 03:38 PM |
| To send an email with the body content extracted from a file | rohit.shetty84 | UNIX for Dummies Questions & Answers | 3 | 05-11-2008 11:32 PM |
| about UNIX? original version? | slowchem | UNIX for Dummies Questions & Answers | 4 | 12-07-2006 01:25 AM |
| Original BYTE UNIX Benchmarks (Version 3.11) | Neo | Linux Benchmarks | 0 | 09-06-2003 03:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How do I make tar set the correct atime on the extracted version? The option --atime-preserve works just on the original, not on the extracted file.
The extracted files always have current time as atime, which is bad. |
|
||||
|
That was quick. Thanks!
This does not seem to work though. See below an example where 2 files (with different atimes) are archived and extracted somewhere else. The last line of output shows that the atime was not preserved. $ ls -lt origin/b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 03:52 origin/bla2 -rw-r--r-- 1 dsilt2 dsilt2 4 2007-07-07 22:22 origin/bla1 $ ls -ltu origin/b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 03:52 origin/bla2 -rw-r--r-- 1 dsilt2 dsilt2 4 2007-07-07 22:22 origin/bla1 $ cd origin/ $ tar --atime-preserve -cvpf archive.tar * bla1 bla2 $ mv archive.tar ../destination/ $ cd ../destination/ $ tar xvpf archive.tar bla1 bla2 $ ls -lt b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 03:52 bla2 -rw-r--r-- 1 dsilt2 dsilt2 4 2007-07-07 22:22 bla1 $ ls -ltu b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 04:01 bla1 -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 04:01 bla2 |
|
||||
|
Sure. Same result. Files are as in previous shell log.
$ rm destination/bla* $ cd destination/ $ tar --atime-preserve -xvpf archive.tar bla1 bla2 $ ls -lt b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 03:52 bla2 -rw-r--r-- 1 dsilt2 dsilt2 4 2007-07-07 22:22 bla1 $ ls -ltu b* -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 04:22 bla1 -rw-r--r-- 1 dsilt2 dsilt2 4 2008-12-15 04:22 bla2 |
|
||||
|
I should add that I don't necessarily have to work with tar, *any* tool that can do it is fine by me, say cpio, scp, and so on. It's just that tar, according to its documentation, at least *seems* able to preserve time and atime (and permissions of course). If someone knows of any other tool that can move files between computers and preserves those 3 things, that's fine by me too.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|