Saturday, October 25, 2014

Copy files with original timestamp in Linux commandline

If you move files on Linux with command mv, time-stamp won't be change, But if you copy with command cp, it'll take current time for time-stamp. If we wanna get original time-stamp, you can use following command on Linux,

cp -R -u -p /source /destination

What is time-stamp ?

When we create or modify file / directory, it'll store creation and / or modification date and time on file / directory properties. Which is called time-stamp.

No comments:

Find and clear log files in Linux

Objective: Find and clear the files with extension of *.log, usually log files. Commands: find . -type f -iname *.log -exec tee {} \;...