How to duplicate a file with the current date and time

To duplicate (backup) a file as filename.unixtimestamp use

cp myfilename{,.`date +%s`}

You can change the date format as per your preference. Below would duplicate it as filename.yyyymmdd

cp myfilename{,.`date +%Y%m%d`}

Tags: ,

Leave a Reply