Directory path

A

Adam Folkesson

Hello, I hope someone can help me because I can't figure out what's
wrong.

Here's a part of my code:
---------------------------------------------------------------------
directory = '/Volumes/Home
Directory/Media/Film/TV-serier/Supernatural/Säsong 5'
files = Dir.entries("#{directory}")
---------------------------------------------------------------------
Works like a charm!

Here's another part of my code:
---------------------------------------------------------------------
File.rename(directory+files[2], directory+episodeList[2])
---------------------------------------------------------------------
Doesn't work!

I get the error: No such file or directory - No such file or directory -
/Volumes/Home Directory/Media/Film/TV-serier/Supernatural/S???song
5supernatural.s05e05.hdtv-lol.avi or /Volumes/Home
Directory/Media/Film/TV-serier/Supernatural/S???song 5S05 E05 - Fallen
Idol.avi (Errno::ENOENT)

What the hell is wrong? I'm using the exact same string, directory. I
know this doesn't work is because I've the letter "ä" in the path. If I
change to an "a" it's works. But I can't understand why, because it
works perfectly with an "ä" in the first part of my code.

Very grateful if someone have the solution to my problem!
 
X

Xavier Noria

Here's a part of my code:

Note that directory is already a string, there's no need to build
another string to interpolate

Dir.entries(directory)

just works.
---------------------------------------------------------------------
Works like a charm!

Here's another part of my =C2=A0code:
---------------------------------------------------------------------
File.rename(directory+files[2], directory+episodeList[2])
---------------------------------------------------------------------
Doesn't work!

I get the error: No such file or directory - No such file or directory -
/Volumes/Home Directory/Media/Film/TV-serier/Supernatural/S???song
5supernatural.s05e05.hdtv-lol.avi or /Volumes/Home
Directory/Media/Film/TV-serier/Supernatural/S???song 5S05 E05 - Fallen
Idol.avi (Errno::ENOENT)

What the hell is wrong?

Could it be the case that you're missing a slash between "S=C3=A4song 5"
and the filename?
 
A

Adam Folkesson

Marnen said:
Really? 'Cause you *are* missing a slash.

If not that, perhaps it's an encoding issue on the ä.


Best,

Yes I know, sorry. But in my "real" code there's a slash, looks like
this: directory = '/Volumes/Home
Directory/Media/Film/TV-serier/Supernatural/Säsong 5/'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top