FileUtils.mv not working?

T

Trans

I'm trying to move a folder from the /tmp dir (accessed via Dir.tmpdir)
to the current working directory. It fails to do the move and instead
just copies the folder. I get no error or warning. I can do it just
find from the command line:

mv /tmp/foo bar

but if I try

ruby -w -rfileutils -e "FileUtils.mv('/tmp/foo', 'bar'))"

It only copies. Anyone have any idea why?

Thanks,
T.

ruby 1.8.4 (2005-12-24) [i486-linux] on ubuntu
 
D

Devin Mullins

Trans said:
I can do it just find from the command line:
mv /tmp/foo bar
but if I try
ruby -w -rfileutils -e "FileUtils.mv('/tmp/foo', 'bar'))"
It only copies. Anyone have any idea why?

FileUtils.mv is a ::cp and an ::unlink behind the scenes. I'm not
familiar enough with Unix permissions -- perhaps they are such that you
can move a file but not remove it?

Devin
 
A

ara.t.howard

I'm trying to move a folder from the /tmp dir (accessed via Dir.tmpdir)
to the current working directory. It fails to do the move and instead
just copies the folder. I get no error or warning. I can do it just
find from the command line:

mv /tmp/foo bar

but if I try

ruby -w -rfileutils -e "FileUtils.mv('/tmp/foo', 'bar'))"

It only copies. Anyone have any idea why?

Thanks,
T.

ruby 1.8.4 (2005-12-24) [i486-linux] on ubuntu

shouldn't you be using .cp_r?

-a
 
T

Trans

I'm trying to move a folder from the /tmp dir (accessed via Dir.tmpdir)
to the current working directory. It fails to do the move and instead
just copies the folder. I get no error or warning. I can do it just
find from the command line:

mv /tmp/foo bar

but if I try

ruby -w -rfileutils -e "FileUtils.mv('/tmp/foo', 'bar'))"

It only copies. Anyone have any idea why?

Thanks,
T.

ruby 1.8.4 (2005-12-24) [i486-linux] on ubuntu

shouldn't you be using .cp_r?

well, i want to move it. of course I can cp_r + rm_r which is
equivalent (and what I ended up doing to work around it) but it seems
to me mv should work.

t.
 

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

Members online

No members online now.

Forum statistics

Threads
474,219
Messages
2,571,117
Members
47,730
Latest member
scavoli

Latest Threads

Top