[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Create a new file name by appending timestamp to original

Sunny Bogawat

5/7/2008 7:48:00 AM

i want a new file name from existing file name but with attaching time
stamp but gives error invalid argument type please tell simple way for
doing this
--
Posted via http://www.ruby-....

5 Answers

Demon-KKKrats are Hate-Filled Marxists

3/30/2008 2:40:00 PM

0

On Mar 28, 11:12 pm, "Justin Case" <Thinh...@pacbell.net> wrote:
> "Coffee in Madrid" <gde...@THISeastlink.ca> wrote in message
> news:gdeppe-4B8E51.19562828032008@[74.223.185.199.nw.nuvox.net]...
>
>
>
>
>
> > In article
> > <03c7a66f-0921-4ff7-a00c-3911bc418...@m36g2000hse.googlegroups.com>,
> > Liberalism is a Mental Disorder <talkradiotruth...@gmail.com> wrote:
>
> >> On Mar 23, 11:18 am, "Tom Sr." <tomswif...@gmail.com> wrote:
> >> > .
> >> > I am very interested in what people believe and why.
>
> >> > -Tom Sr.
>
> >> Maybe it would be more interesting if you shared what you believe,
> >> Commie Tom.  Or are you afraid of starting a topic with an opinion,
> >> for fear that someone might tear you up?
>
> >> Completely worthless as always Commie Tom.  Putin be not proud.
>
> > The same "god" is found on BOTH sides.
>
> Allah and Yahwey are entirely different entities but that is irrelevant.
> God is on his own side and has nothing to do with any present conflict in
> Iraq.  Please don't blame God for the faults of man.
>
>

God has everything to do with every conflict. In Iraq and
Afghanistan, God's people are fighting Satan's suicide-bombing
freaks. Same thing in Israel.


>
>
>
> > Only the rituals vary.
>
> > Never ceases to amaze me how humanity always lets the rituals take over
> > and confuse the beleiver.
>
> > Coffee in 1555 AD- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Robert Klemme

5/7/2008 8:51:00 AM

0

2008/5/7 Sunny Bogawat <sunny_bogawat@neovasolutions.com>:
> i want a new file name from existing file name but with attaching time
> stamp but gives error invalid argument type please tell simple way for
> doing this

If you do not tell us what you did and what error you saw we cannot
help you. Did you look at
http://www.ruby-doc.org/core/classes/Time.ht... ?

Kind regards

robert

--
use.inject do |as, often| as.you_can - without end

Sunny Bogawat

5/7/2008 9:09:00 AM

0

Robert Klemme wrote:
> 2008/5/7 Sunny Bogawat <sunny_bogawat@neovasolutions.com>:
>> i want a new file name from existing file name but with attaching time
>> stamp but gives error invalid argument type please tell simple way for
>> doing this
>
> If you do not tell us what you did and what error you saw we cannot
> help you. Did you look at
> http://www.ruby-doc.org/core/classes/Time.ht... ?
>
> Kind regards
>
> robert

i want attaches a timestamps to file for this i doing Time.now_filename
but it gives error because time has a space sum it so i need some
another mechanism using which i generate timestamps and attached to
timestamps.
--
Posted via http://www.ruby-....

Peña, Botp

5/7/2008 9:39:00 AM

0

RnJvbTogU3VubnkgQm9nYXdhdCBbbWFpbHRvOnN1bm55X2JvZ2F3YXRAbmVvdmFzb2x1dGlvbnMu
Y29tXSANCiMgaSB3YW50ICBhdHRhY2hlcyBhIHRpbWVzdGFtcHMgdG8gZmlsZSBmb3IgdGhpcyBp
IGRvaW5nIA0KIyBUaW1lLm5vd19maWxlbmFtZSANCiMgYnV0IGl0IGdpdmVzIGVycm9yIGJlY2F1
c2UgdGltZSBoYXMgYSBzcGFjZSBzdW0gaXQgc28gaSBuZWVkIHNvbWUgDQojIGFub3RoZXIgbWVj
aGFuaXNtIHVzaW5nIHdoaWNoIGkgZ2VuZXJhdGUgdGltZXN0YW1wcyBhbmQgYXR0YWNoZWQgdG8g
DQojIHRpbWVzdGFtcHMuDQoNCnBhcmRvbiBtZSBpZiBpIGRvIG5vdCBnZXQgeW91IHJpZ2h0IGhl
cmUsIGJ1dCBkbyB5b3Ugd2FudCBzb21ldGhpbmcgbGlrZSB0aGlzLCBlZz8NCg0Kc3lzdGVtICJk
aXIgKnRlc3RpbmcucmIiDQowMS8zMS8yMDAzICAwNTo1NSBQTSAgICAgICAgICAgICAgICAgNCB0
ZXN0aW5nLnJiDQogICAgICAgICAgICAgICAxIEZpbGUocykgICAgICAgICAgICAgIDQgYnl0ZXMN
CiM9PiB0cnVlDQoNCnJlcXVpcmUgJ2ZpbGV1dGlscycNCiM9PiB0cnVlDQoNCkZpbGVVdGlscy5t
diBmLCBbVGltZS5ub3cuc3RyZnRpbWUoIiVZLSVtLSVkLSVIJU0lUyIpLGZdLmpvaW4oIl8iKQ0K
Iz0+IDANCg0Kc3lzdGVtICJkaXIgKnRlc3RpbmcucmIiDQowMS8zMS8yMDAzICAwNTo1NSBQTSAg
ICAgICAgICAgICAgICAgNCAyMDA4LTA1LTA3LTE3MzEzOV90ZXN0aW5nLnJiDQogICAgICAgICAg
ICAgICAxIEZpbGUocykgICAgICAgICAgICAgIDQgYnl0ZXMNCiM9PiB0cnVlDQoNCg0Ka2luZCBy
ZWdhcmRzLA0KLWJvdHAgDQo=

Robert Klemme

5/8/2008 4:48:00 PM

0

On 07.05.2008 11:08, Sunny Bogawat wrote:
> Robert Klemme wrote:
>> 2008/5/7 Sunny Bogawat <sunny_bogawat@neovasolutions.com>:
>>> i want a new file name from existing file name but with attaching time
>>> stamp but gives error invalid argument type please tell simple way for
>>> doing this
>> If you do not tell us what you did and what error you saw we cannot
>> help you. Did you look at
>> http://www.ruby-doc.org/core/classes/Time.ht... ?
>
> i want attaches a timestamps to file for this i doing Time.now_filename
> but it gives error because time has a space sum it so i need some
> another mechanism using which i generate timestamps and attached to
> timestamps.

Not sure what you are really doing, I get

$ ruby -e 'Time.now_filename'
-e:1: undefined method `now_filename' for Time:Class (NoMethodError)

But Pena's solution is probably what you want. Here's another approach:

file_name = "base_name-#{Time.now.strftime('%Y%m%d-%H%M%S')}"

Kind regards

robert