From: "nagachika (Tomoyuki Chikanaga)" Date: 2013-03-30T21:57:09+09:00 Subject: [ruby-core:53843] [ruby-trunk - Bug #8109] FileUtils.mv fails across devices on Windows Issue #8109 has been updated by nagachika (Tomoyuki Chikanaga). Hello, usa san, it seems a long-standing bug, isn't it? Do you want to backport r40001 to 1.9.3 branch? I will take a leaf from your opinion for 2.0.0. Thanks. ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109#change-38052 Author: mitchellh (Mitchell Hashimoto) Status: Closed Priority: Normal Assignee: cruby-windows Category: platform/windows Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365239(v=vs.85).aspx Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx The MoveFileEx call with the proper flag will just do the right thing. -- http://bugs.ruby-lang.org/