Trying to move and rename photos from a media card using OS X.
I get this error:
Errno::EXDEV: Cross-device link -
/Volumes/CANON_DC/DCIM/100CANON/IMG_2324.JPG or /Volumes/Knobby Aperture
Disk/Photos-digital/ Photographs/_Download folder/Latest
Download/2007.01.11-2324.gs-c.jpg
basic command is:
File.rename(File.join(dirPhotoCard, fileName), File.join(downloadFolder,
newFileName))
Works fine if I chang the dirPhotoCard to a folder on my Mac
I basically following Pine’s Renamimg your photos script. I went back
and tried his script and I got the same results. Worked with Mac to Mac,
but not media card to Mac.
I tried a different type of card (Compact Flash instead of SD and got
the same results).
Thanks for any suggestions
This issue has already been discussed on this list:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/248527
If you still can’t copy files, you may not have sufficient
reading/writing privileges for the device or it might not be
mounted …
Best regards,
Axel
Axel E. wrote:
This issue has already been discussed on this list:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/248527
Axel
Thanks, that got me to a solution. I found a related discussion at
http://www.ruby-forum.com/topic/78627#128289
I went with since it breaks the operation down into more understand
steps, and it works:
require ‘fileutils’
include FileUtils
cp(old, new ) # copy(old,new) works too if you like me don’t talk UNIX
rm (old) # remove(old)
There seems to be some confusion about how Ruby handles moving (mv)
files. Moving files is supposed to work with rename, but apparently
breaks down when the new and old directories are not in the same
partition. But the cp and rm steps are clearer than renaming and moving
(copying and deleting) in one step which is what I’m trying to do. (In
other words, it’s not obvious from the name that “rename” renames and
moves.