Adding date and time to a filename

interpretive language scripts


Moderator: Forum moderators

Post Reply
User avatar
amethyst
Posts: 2357
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 477 times

Adding date and time to a filename

Post by amethyst »

Useful for backups, etc. Example of renaming an existing file:

Code: Select all

mv /adrv_racy_extra.sfs /adrv_racy_extra_$(date +%d-%m-%Y-%H:%M).sfs

Of course also useful when creating a new file with date/time, for instance creating an sfs file with mksquashfs.

User avatar
wiak
Posts: 3673
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 57 times
Been thanked: 1028 times
Contact:

Re: Adding date and time to a filename

Post by wiak »

Yes, that's a good idea. I think I'll adopt it when not relying on git (nevertheless, I should rely on my git cloned archives more than I do in practice).

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Post Reply

Return to “Scripts”