[LBo] howto generate file names with dates for TAR backups?

Anita Lewis a.lewis at linuxbasics.org
Mon Feb 5 13:11:55 CET 2007


On 02/05/2007 06:54 AM Andrew Henry wrote:
)
> =

> but I only want a portion of the date without spaces so that I can later
> concatenate it to the file name:
> =

> backup-level0-[date].tar.
> =

> 1.  How to I truncate the date command?
> =

> 2.  How do I concatenate it to the end of my file name?
> =

> --andrew
> =


I'm using Stefan's method.  Is this close to what you want?

http://linuxbasics.org/tutorials/advanced/realworld/backup_your_data#tar

The meat of it is:

export FN=3D`date +%Y-%m-%d-%a-%Hh%M.tgz`
time tar cvfz /save/storage/Daily-$FN /important-data

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://linuxbasics.org/pipermail/qna/attachments/20070205/6c7b6fbe/si=
gnature.pgp


More information about the QnA mailing list