File.move command

B

barjunk

I thought if I did:

File.move("mydir","mynewdir")


it would do a move...but it seems to make a file out of the directory
I'm trying to move.

The end result I get is a file named mynewdir. What I want is a new
directory containing all of the information in the mydir directory
called mynewdir.

Am I going to have to use a copy and a rm of the old dir?

What's the "right way" to do that?

Mike B.
 
B

barjunk

I thought if I did:

File.move("mydir","mynewdir")

it would do a move...but it seems to make a file out of the directory
I'm trying to move.

The end result I get is a file named mynewdir. What I want is a new
directory containing all of the information in the mydir directory
called mynewdir.

Am I going to have to use a copy and a rm of the old dir?

What's the "right way" to do that?

Mike B.


I forgot to add that it is ruby 1.8.4.
 
L

Logan Capaldo

I thought if I did:

File.move("mydir","mynewdir")


it would do a move...but it seems to make a file out of the directory
I'm trying to move.

The end result I get is a file named mynewdir. What I want is a new
directory containing all of the information in the mydir directory
called mynewdir.

Am I going to have to use a copy and a rm of the old dir?

What's the "right way" to do that?
I can't find a File::move, I dunno where you got it from (some lib?).
One method is File::rename, another is to require 'fileutils' and use
FileUtils.mv
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,264
Messages
2,571,315
Members
48,000
Latest member
SusannahSt

Latest Threads

Top