Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter file without chaging the timestap 3

Status
Not open for further replies.

logic2fun

IS-IT--Management
Mar 19, 2008
8
0
0
US
How can i change or copy a file without changing its permissions and timestamp of creation of the file.

i tried cp -p but doesnt seem to be working
 
cp -p should work fine for copying the file without changing timestamp or permissions, can you show us an example of it failing to do so? What operating system are you on?

You can't change a file without altering a timestamp, however you can change the timestamp back to what it was manually using the touch command.

Annihilannic.
 
cp -p will keep the timestamp of the file being copied. But i want it the other way round

-rwxr-xr-x 1 XXX XXX 243 Apr 1 16:29 sum.sh

Lets say the above file is already in place and i want to overwrite it with the following file

-rwxr-xr-x 1 XXX XXX 243 Apr 2 00:29 sum.sh
Which is basically newer version of it, how can i change it retaining the original timestamp.. in this case 16:29.

Thoughts ?
 
This seems like a recipe for avoiding some kind of auditing/monitoring of changes to files? Or maybe it's just my suspicious mind!

I want to be good, is that not enough?
 
Ken, if that was so, the example command should be...
Code:
touch -t 04011629 /etc/shadow

[bigsmile]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top