[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Stupid Question #498 - How do I move a directory?

Berger, Daniel

11/26/2003 3:31:00 PM

> -----Original Message-----
> From: Allton, Paul [mailto:Paul.Allton@DrKW.com]
> Sent: Wednesday, November 26, 2003 7:25 AM
> To: ruby-talk@ruby-lang.org
> Subject: Stupid Question #498 - How do I move a directory?
>
> Preferably in a platform neutral manner, but it must
> definitely work on windows.
>
> Where 'old' and 'new' are fully qualified directory names:
>
> - File.move(old, new) results in:
>
> C:/ruby/lib/ruby/1.8/ftools.rb:62:in `readlink': The
> readlink() function is unimplemented on this machine
> (NotImplementedError)
>
> from C:/ruby/lib/ruby/1.8/ftools.rb:62:in `move'

Hi Paul,

That means there was something wrong with your choice of file names
because File.move in ftools.rb attempts to call 'rename' first. Only if
that fails does it resort to readlink. My guess would be that either
'old' does not exist, or that you forgot to include a double backslash
inside double quotes, e.g. "C:\temp1" vs "C:\\temp1".

You can avoid ftools or fileutils altogether and simply use File.rename.
Just tested it on my Windows XP box and it works fine.

Regards,

Dan