Unix questions - How to easily append (in shell script) a timestamp to tar archive name ?

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > December 2007 > How to easily append (in shell script) a timestamp to tar archive name ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to easily append (in shell script) a timestamp to tar archive name ?
Matthew Lincoln

2007-12-12, 1:26 pm

I would like to create a tar archive with the well known tar command

tar czvf "/usr/local/user234/bkp.tar.gz" /home/users/pmiller/

It works. However I would like to automatically append a timestamp whenever I call this command
in a shell script.

The created archive file name should look like

bkp-20071109-1523.tar.gz

Where the format is preferred as YYYYMMDD-HHMM

Does (Gnu-)tar offer such an automatic timestamp appending?

If not: Is there a (short) work around (in bash) which let me create such a timestamp?

Thank you
Matthew
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com