Forum: Ruby Re: File basenames using File.basename . . .

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-04-13 18:39
(Received via mailing list)
> -----Original Message-----
> From: removed_email_address@domain.invalid
> [mailto:removed_email_address@domain.invalid] On Behalf Of Peter B.
> Sent: Thursday, April 13, 2006 5:57 AM
> To: ruby-talk ML
> Subject: Re: File basenames using File.basename . . .

<snip>

> Thanks, Dan. Both of your suggestions worked for me. Now, how could I
> fulfill my instructions in the filesystem itself, not just in
> the array?
> I know I can do it with a system("ren *.txt *."), but, how
> would I do it
> in RUBY?

To rename individual files, use File.rename.  For batches of files I'm
not sure off the top of my head, but I'm guessing there's a method in
either FileUtils or ftools.

Regards,

Dan
Peter B. (Guest)
on 2006-04-13 21:21
Berger, Daniel wrote:
>> -----Original Message-----
>> From: removed_email_address@domain.invalid
>> [mailto:removed_email_address@domain.invalid] On Behalf Of Peter B.
>> Sent: Thursday, April 13, 2006 5:57 AM
>> To: ruby-talk ML
>> Subject: Re: File basenames using File.basename . . .
>
> <snip>
>
>> Thanks, Dan. Both of your suggestions worked for me. Now, how could I
>> fulfill my instructions in the filesystem itself, not just in
>> the array?
>> I know I can do it with a system("ren *.txt *."), but, how
>> would I do it
>> in RUBY?
>
> To rename individual files, use File.rename.  For batches of files I'm
> not sure off the top of my head, but I'm guessing there's a method in
> either FileUtils or ftools.
>
> Regards,
>
> Dan


Makes sense. Thanks.
This topic is locked and can not be replied to.