Topic: Split a windows path?
I am trying to split a windows pathname down into the component bits but of course the bloody backslashes are calling problems. How would you split the following?
"C:\Documents and Settings\user\Desktop\screenshot.jpg"
The following doesn't work and I am not sure how to escape it.
"C:\Documents and Settings\user\Desktop\screenshot.jpg".split('\')
Using
"C:\Documents and Settings\user\Desktop\screenshot.jpg".split('\\')
results in
"C:Documents and SettingsuserDesktopscreenshot.jpg"
Basically I am trying to get the filename. I can't use the pathname2 gem to create a windows path because I am getting errors when I try and run it from the Gem.
Can anyone quikly give me the code I should put in the split command?
thanks
rJ