Directory path

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!

On Tue, Nov 17, 2009 at 10:00 PM, Adam Folkesson
[email protected] wrote:

Here’s a part of my code:

directory = ‘/Volumes/Home
Directory/Media/Film/TV-serier/Supernatural/Säsong 5’
files = Dir.entries(“#{directory}”)

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

Dir.entries(directory)

just works.

/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äsong 5”
and the filename?

Could it be the case that you’re missing a slash between “Säsong 5”
and the filename?

No, already tried that :confused:

Adam Folkesson wrote:

Could it be the case that you’re missing a slash between “Säsong 5”
and the filename?

No, already tried that :confused:

Really? 'Cause you are missing a slash.

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

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Adam Folkesson wrote:

Could it be the case that you’re missing a slash between “Säsong 5”
and the filename?

No, already tried that :confused:

Really? 'Cause you are missing a slash.

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

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

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/’

Marnen Laibow-Koser wrote:

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

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Yes, but why does it work here?: Dir.entries(“#{directory}”)