
January 20th, 2005, 01:13 AM
|
 |
Contributing User
|
|
Join Date: Aug 2003
Location: under a rock
Posts: 54
Time spent in forums: 11 h 20 m 42 sec
Reputation Power: 5
|
|
Quote: | Originally Posted by svvc I need a unix script to rename a file as timestamp tagged at the end.
If i have a file named file.txt created on 01/07/2005. I need the script such that it renames the file file.txt to file01072005.txt | Hmm. Five hours and no reply. Maybe this looks too much like a classroom assignment. Well, here's the quick version:
man date
man cut (use fields if everything follows a [name.suffix] convention)
If you aren't (re)naming the file as you create it--instead you're renaming files already there--man awk to cull the timestamp from ls.
PS: I recommend changing your date-incorporated-into-a-filename format from '01072005' to '20050107.' If you're wondering why, create about forty files named "access_report-[date].txt" and then list the files. Isn't it nice to not have to switch between sorting by filename and sorting by date? ;)
__________________
Mother says my .sig can beat up your .sig.
|