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


A

Allton, Paul

------_=_NextPart_001_01C3B429.104C0C6E
Content-Type: text/plain

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'



- system("move #{old} #{new}") - just returns false and does nothing



- I expected Dir to have a move method, but couldn't find it.



Obviously I could iterate through the files and move them one at time, but
there must be a simpler way...







--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
 
Ad

Advertisements

G

gabriele renzi

il Wed, 26 Nov 2003 23:25:02 +0900, "Allton, Paul"
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'

FileUtils.move dir1 dir2 seemto work for mw on winxp.
Oh, now I understand why we have bot fileutils ans ftools :))
 

Top