This may apply to general file-system as well.
In my case I want to write files on Aws-S3 where the key(filename) is actually a url path.
For example :
url = "http://example.com/where/are/we/"
then filename would be
filename = "where/are/we/"
To write in S3 :
s3 = AWS::S3.new
s3.buckets[BUCKET].objects["locations/#{filename}"].write(file_contents)
But as expected the key creates sub-folders inside BUCKET/locations/where/are/we/
My last resort would be filename.gsub!('/', '_')
Any possible solution/workaround would be awesome!