[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Cross-device link error

Greg

4/20/2007 12:42:00 AM

Working through Pine's Programming book and got this error (complete at
bottom):

Cross-device link -...(Errno::EXDEV)

Trying to read photos from a memory card to hard drive and rename them.
Someone posted the same error on the book's errata page and I didn't
see a response so though I better look elsewhere

gscar-computer:~ gscar$ ruby "/Users/gscar/Documents/Ruby/Pine-Learning
to Script/RenamingYourPhotos\302\24711.5.y.rb"
What would you like to call this batch?
Testing

Downloading 3 files:
/Users/gscar/Documents/Ruby/Pine-Learning to
Script/RenamingYourPhotos§11.5.y.rb:38:in `rename': Cross-device link -
/Volumes/CANON_DC/DCIM/100CANON/IMG_2324.JPG or Testing01.jpg
(Errno::EXDEV)
from /Users/gscar/Documents/Ruby/Pine-Learning to
Script/RenamingYourPhotos§11.5.y.rb:38
from /Users/gscar/Documents/Ruby/Pine-Learning to
Script/RenamingYourPhotos§11.5.y.rb:28:in `each'
from /Users/gscar/Documents/Ruby/Pine-Learning to
Script/RenamingYourPhotos§11.5.y.rb:28
=======
Line 28 is: picNames.each do |name| â?¨Line 38 is: File.rename name, newName

Thanks for any help

Newbie

2 Answers

Dan Zwell

4/20/2007 6:04:00 AM

0

Greg wrote:
> Working through Pine's Programming book and got this error (complete at
> bottom):
>
> Cross-device link -...(Errno::EXDEV)
>
> Trying to read photos from a memory card to hard drive and rename them.
> Someone posted the same error on the book's errata page and I didn't see
> a response so though I better look elsewhere
>
> gscar-computer:~ gscar$ ruby "/Users/gscar/Documents/Ruby/Pine-Learning
> to Script/RenamingYourPhotos\302\24711.5.y.rb"
> What would you like to call this batch?
> Testing
>
> Downloading 3 files:
> /Users/gscar/Documents/Ruby/Pine-Learning to
> Script/RenamingYourPhotos§11.5.y.rb:38:in `rename': Cross-device link -
> /Volumes/CANON_DC/DCIM/100CANON/IMG_2324.JPG or Testing01.jpg
> (Errno::EXDEV)
> from /Users/gscar/Documents/Ruby/Pine-Learning to
> Script/RenamingYourPhotos§11.5.y.rb:38
> from /Users/gscar/Documents/Ruby/Pine-Learning to
> Script/RenamingYourPhotos§11.5.y.rb:28:in `each'
> from /Users/gscar/Documents/Ruby/Pine-Learning to
> Script/RenamingYourPhotos§11.5.y.rb:28
> =======
> Line 28 is: picNames.each do |name| â?¨Line 38 is: File.rename name, newName
>
> Thanks for any help
>
> Newbie
>
>
>

You've gotta give us some more information. It would be better to
include the whole method than just one line.

Dan

Nobuyoshi Nakada

4/20/2007 6:23:00 AM

0

Hi,

At Fri, 20 Apr 2007 09:45:06 +0900,
Greg wrote in [ruby-talk:248510]:
> Working through Pine's Programming book and got this error (complete at
> bottom):
>
> Cross-device link -...(Errno::EXDEV)
>
> Trying to read photos from a memory card to hard drive and rename them.

File.rename doesn't copy file content, just change the name.
So it can't move a file across devices. You may want to use
FileUtils.cp method.

--
Nobu Nakada