[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: renaming file to current date ?

On Tue, Aug 29, 2006 at 09:24:26AM -0700, S t i n g r a y wrote:
> Well i want to know if its possible to rename a file
> to the current date ?
> like if i want to move todays date to the file name ?

  Say the file you want to rename is "t.txt" you could use:

  mv t.txt `date +%d-%m-%Y`

  That gives you the file "29-08-2006".

  If you wanted to keep the suffix you could use:

  mv t.txt `date +%d-%m-%Y`.txt

  See "man date" for the explaination of the %d, %m, and %Y terms.

Debian GNU/Linux System Administration

Reply to: