Sometimes we need to change a file without changing timestamp of a file in unix .
This can simply be done by using touch command .
$ touch -r -- command will create a file with same timestamp as old one.
In above commands it is clear that there was one file date1.txt which was created on 3rd April and then command :
$ touch -r [source_file_name_whose_timestamp_is_copied][target_file_with_same_timestamp_as_source_file]
This command creates another file date.txt which is of size zero and old timestamp .
Comments