Main Menu

Search

LINUX: Take Backup of Files Using DateTimeStamps In Backup Filename (How To Doc)

Below is the command to take backup of file so that backup file has datetimestamps (Date / Timestamps) in name when the file was backed up.
cp -rp testfile.out testfile.out__$(date +%F'-'%T)

In above command example we are backing up testfile.out. Change this filename to the filename you want to backup. Below is example snippet which shows the backup file created with datetimestamps (highlighted in bold).

-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out__2019-09-28-14:39:16
-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out

Products to which Article Applies

All UNIX Operating Systems



tarun boyella

No comments:

Post a Comment