View Single Post

  #1 (permalink)  
Old 03-29-2006, 02:52 PM
warren warren is offline
Member
User
 
Join Date: Jun 2005
Posts: 45
Rep Power: 0
warren
Default How can I rename a file by its date?

I have here a simple question.

I have a file named "log.txt"and the date modified is Mar 29, 2006 16:55
I am planning to rename/create link of "log.txt" to "Mar 29, 2006 1655.txt"
The problem is how can I get that string.

Sol. 1
-bash-3.00# stat --format=%y log.txt
2006-03-29 16:55:41.571766000 +0800
But the problem is how can I convert that to string "Mar 29, 2006 1655"

Sol 2.
-bash-3.00# ls -l --time-style="+%b %e, %Y %k%M" log.txt
-rw-rw-rw- 1 root root 0 Mar 29, 2006 1655 log.txt
I have that string but the problem is how can I filter that string.

Thanks in advance for any help
warren
Reply With Quote