Here is an example to make this a bit more concrete: <br><br>date > t; sleep 3; cp t t.cp;<br>perl -MFile::stat -le 'for ("t", "t.cp"){ $t = stat $_; print join " ", $t->atime, $t->ctime, $t->mtime}'<br>
1239288602 1239288599 1239288599<br>1239288602 1239288602 1239288602<br><br>Note especially that both ctime and mtime have been updated even though the content has not changed. Also atime on the original file because it was accessed to copy it.<br>
<br><br><div class="gmail_quote">On Tue, Apr 7, 2009 at 11:05 PM, David L. Anselmi <span dir="ltr"><<a href="mailto:anselmi@anselmi.us">anselmi@anselmi.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">chris fedde wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Apr 7, 2009 at 8:44 PM, David L. Willson <<a href="mailto:DLWillson@thegeek.nu" target="_blank">DLWillson@thegeek.nu</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Why is that when I copy a file from one place to another, the mtime<br>
updates?<br>
</blockquote></blockquote>
><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mtime is the time when the file's inode was modified. The file system<br>
sees that the copy is a new inode so mtime is updated.<br>
</blockquote>
<br></div>
What Chris said. Except I think mtime is when the file data changes. ctime is the inode time. So now tell me why mv doesn't change the mtime (or atime). And besides ctime, what other times change? And with cp, what other times change?<br>
<br>
So you can use -p if you don't want the times changed.<br>
<br>
Dave<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
clue-tech mailing list<br>
<a href="mailto:clue-tech@cluedenver.org" target="_blank">clue-tech@cluedenver.org</a><br>
<a href="http://www.cluedenver.org/mailman/listinfo/clue-tech" target="_blank">http://www.cluedenver.org/mailman/listinfo/clue-tech</a><br>
</div></div></blockquote></div><br>