Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Odd Error in FileUtils with move and ENOENT

Reply
Thread Tools

Odd Error in FileUtils with move and ENOENT

 
 
Charles Comstock
Guest
Posts: n/a
 
      10-18-2004
Note quite sure what the cause of this is but if I use the File.move
code below I get no errors, but if I use the commented out FileUtils
line then I get a whole serious of errors like this:

Exception `Errno::ENOENT' at
/home/cec/s/c/cc1/usr/lib/ruby/1.8/fileutils.rb:860 - No such file or
directory - /.autofs/home/grader/cse425gr/hw2/q9.scm

where hw2/q9.scm is where I am trying to move the directory entry d to,
so obviously it doesn't exist. I tried wrapping it in a begin/rescue as
well but it doesn't seem to allow that as they appear to be jumping
straight out of fileutils. Any idea on how to avoid this error output?

# pull directory up
dir = Dir["*"].shift
if !dir.nil? && FileTest.directory?(dir)
pwd = FileUtils.pwd
FileUtils.cd(dir) do
Dir["*"].each {|d| File.move d, ".."}
end
#FileUtils.move Dir[dir+"/*"], Dir.pwd
FileUtils.rm_rf dir
end

All I am trying to do is pull everything in a subdirectory up to the
directory above it, so any other suggestions that would fix that problem
would be appreciated.

In both cases the file does copy as it is supposed to, it just pukes all
of my screen doing it using fileutils.
Charles Comstock

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: while executing gem (Errno::ENOENT) Dog Day Ruby 2 01-26-2011 04:06 PM
Ruby cannot find the file in the directory - Error Enoent Sask Khan Ruby 4 03-30-2010 05:29 AM
FileUtils.mv Pointless Errno::ENOENT Intransition Ruby 2 09-12-2009 08:09 PM
Error using csv.rb - (Errno::ENOENT) Jonathan Kohl Ruby 2 04-06-2005 03:15 AM
Exceptions list - Unix ENOENT not the name of the exception - what is? Graham Nicholls Ruby 9 07-05-2004 11:34 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57