News for hackers. Stuff that matters.
Re:Useful command-line scripts for web developers (or anyone... by blogimus on Friday June 05, 2009 @10:59AM (#643287)
I frequently need to create datestamped archives.

Here is a one-line example, given two parameters. $1 is the archive name prefix and $2 is the directory to archive.

  tar -cvzf ${1}-$(date +%Y%m%d-%H%M).tar.gz $2
Note, if $2 contains path information (such as absolute path), that path will be stored in the tar. So it is usually used with the working dir as the parent of $2.

There are no comments on this comment yet.