# Moving photos from a media card

**URL:** <https://www.ruby-forum.com/t/moving-photos-from-a-media-card/107292>\
**Category:** Ruby\
**Created:** [June 20, 2007, 7:31am UTC](https://www.ruby-forum.com/t/moving-photos-from-a-media-card/107292 "2007-06-20T07:31:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 20, 2007, 7:31am UTC](https://www.ruby-forum.com/t/moving-photos-from-a-media-card/107292/1 "2007-06-20T07:31:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 20, 2007, 11:45am UTC](https://www.ruby-forum.com/t/moving-photos-from-a-media-card/107292/2 "2007-06-20T11:45:01Z")

</div>

This issue has already been discussed on this list:

[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/248527](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

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 20, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/moving-photos-from-a-media-card/107292/3 "2007-06-20T19:15:45Z")

</div>

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](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](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.
