View Single Post
  #3  
Old 10-01-2020, 12:30 PM
joey joey is offline
Registered User
 
Join Date: Sep 2020
Posts: 2
Specifically, I have a file that is generated on the local system that always has the same name, like "backup.tar.gz". I would like to be able to use a command on the local system that would copy the file to another system. In order to prevent overwriting the previous backup/file, I would like to append the date to the end of the filename, so the copy on the remote system is "backup-2020-10-01.tar.gz".

An example would be:
Code:
command-to-generate-local-backup-file
scp /filesystem/folder/backup.tar.gz  usr@server.example.com:/backups/backup-2020-10-01.tar.gz
Password: (entered manually)
command-to-delete-local-backup-file
This would allow the creation of the file, transfer with automatic naming at destination, then deletion of file on local system (since local system only has enough extra space to have one backup at a time).

Does that help clarify what I am trying to do? (For what it is worth, I could imagine that being able to use this sort of variable, especially if it uses a standard set of formats [similar to what Linux can do with things like %F-%T], would be useful if I was trying to move or rename files either direction.)
Reply With Quote