vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Peter, This is documented in man mv. A little excerpt: When both source and destination are on the same filesystem, they are the same file (just the name is changed; owner, mode, timestamps remain unchanged). When they are on different filesystems, the source file is copied and then deleted. mv will copy modification time, access time, user and group ID, and mode if possible. When copying user and/or group ID fails, the setuid and setgid bits are cleared in the copy. You could always use touch. mv olddir newdir; touch newdir |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Peter wrote: > I am renaming a directory and its modification time remains the same. > Is this normal? Yes. You aren't changing the contents of the directory, so it's mtime doesn't change. You /are/ changing the metadata about the directory, so it's ctime will change, as will the mtime of the parent directory (the file in which the target directory node is recorded). > If so, is there any way to have it change when it is renamed/moved? Probably. But, you need to alter the contents of the directory in order to alter it's mtime. A rename doesn't alter the contents any. P'haps touch will do. Experiment a bit. - -- Lew Pitcher IT Specialist, Enterprise Data Systems, Enterprise Technology Solutions, TD Bank Financial Group (Opinions expressed are my own, not my employers') -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) iD8DBQFD9NZragVFX4UWr64RAqG0AJwL9hIbl5zQ0QwFw0JLdo iJ9v1iCACgxkyE PQ/Ivm9YH7RFjLM8lr3g6Dg= =nZIE -----END PGP SIGNATURE----- |
| |||
| Thanks for your reply but I tested with ctime and it also does not change after a directory move/rename: root@marty:/vol3# ls -lhc --full-time drwxr-xr-x 2 root root 48 2006-02-16 15:24:17.000000000 -0500 test/ root@marty:/vol3# mv test test2 root@marty:/vol3# ls -lhc --full-time drwxr-xr-x 2 root root 48 2006-02-16 15:24:17.000000000 -0500 test2/ |
| ||||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Peter wrote: > Thanks for your reply but I tested with ctime and it also does not > change after a directory move/rename: You are correct. I realized afterword that I was wrong about the ctime. ctime would only change if you changed the directory metadata (extended or truncated the directory, changed it's permission bits, owner, etc.). Since this is a rename, only the parent directory changes, so it's mtime would change. But since a rename doesn't change the target's metadata, the target directory ctime wouldn't change. Sorry for the initial misinformation. [snip] - -- Lew Pitcher IT Specialist, Enterprise Data Systems, Enterprise Technology Solutions, TD Bank Financial Group (Opinions expressed are my own, not my employers') -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) iD8DBQFD9ONVagVFX4UWr64RApBkAKCfyfcxhRcZ86eb5bU0VV 7oxd/QhwCfXIvC kzSszNnE4SUGLfvNV0H9QSw= =fZqW -----END PGP SIGNATURE----- |