From: Ezra Zygmuntowicz [mailto:ezra / yakima-herald.com] wrote:

>Thanks for everyones Ideas on this one. It works perfectly. If anyone  
>has the need to do something similar heres the code:
>
>def rename(filename)
>   new_name = File.join(File.dirname(filename), fix_name(File.basename 
>(filename)))
>   File.move(filename, new_name)
>end
>
>def fix_name(name)
>         name.gsub!(/[\s_]/, "-")
>         name.downcase!
>         name.gsub!(/[^a-z0-9.-]*/, '')
>         name.gsub!(/^-/,'')
>end

To be more general, you might want to verify that a filename is not all
special characters.  I don't know what File.move will do when new_name
is just the directory name (i.e., the entire filename was replaced with
''), but I doubt it is what you want.


**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.