7stud -- wrote:
>> Delete 1500 files by hand?
> 
> Ah.  I think I get what you mean now.  Instead of deleting the files, 
> you would have the program collect all the files in a new directory. 
> Then after running the program if the original ruby install works 
> correctly, you know you can safely run another program to delete all the 
> files in the new directory.

Exactly ... stage the deletes somewhere like ${HOME}/temp_delete and, if 
everything looks ok do a simple rm -rf ...

> 
> One problem I see with that is: if your original ruby install failed to 
> work correctly, you won't have any idea how to put everything back 
> together again.  In order to know how to put all the files back in their 
> previous locations, you would have to do something like create a file in 
> the new directory which lists the original path of the each file and the 
> new path.  Then you could create a program that reads that file and 
> moves all the files back to their previous directories.  Or is there an 
> easier way?

There is an easier way :-) Preserve the path underneath the temp root... 
something like:


  def delete_to_stage(file)
    destdir = File.join(TEMPROOT, File.dirname(file))
    FileUtils::mkdir_p(destdir)
    FileUtils::mv(file, destdir)
  end

Then you know exactly where things go back if need be...

Cheers,
Tim
-- 
Posted via http://www.ruby-forum.com/.