UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 19th, 2005, 06:59 PM
svvc svvc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 12 svvc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 58 sec
Reputation Power: 0
Tag Timestamp to a file

Hi,

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

I appreciate your help

Thanks

Sam

Reply With Quote
  #2  
Old January 20th, 2005, 01:13 AM
zedmelon's Avatar
zedmelon zedmelon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: under a rock
Posts: 54 zedmelon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Tag Timestamp to a file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway