[NTLUG:Discuss] tar file with date?

Brian Rogers brog45 at gmail.com
Tue Aug 5 10:58:40 CDT 2008


On Tue, Aug 5, 2008 at 10:39 AM, m m <llliiilll at hotmail.com> wrote:

>
> I am trying back the while directory with tar.
> I want to have current date append to the backed up file name.
> Google result is
>
> tar cvf backup_`date +%d%m%y`.tar
>
> however, it just don't work on my box.



This works:
tar cvf backup_$(date +'%d%m%y').tar

But I recommend the following because it alphabetizes in chronological
order:
tar cvf backup_$(date +'%Y%m%d').tar

/* Brian Rogers, professional geek, coffee achiever */


More information about the Discuss mailing list