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

Discussion in 'Ruby' started by Allton, Paul, Nov 26, 2003.

  1. Allton, Paul

    Allton, Paul Guest

    ------_=_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.
     
    Allton, Paul, Nov 26, 2003
    #1
    1. Advertisements

  2. il Wed, 26 Nov 2003 23:25:02 +0900, "Allton, Paul"
    FileUtils.move dir1 dir2 seemto work for mw on winxp.
    Oh, now I understand why we have bot fileutils ans ftools :))
     
    gabriele renzi, Nov 26, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.