From: Jeremy Bopp Date: 2012-01-21T08:45:30+09:00 Subject: Re: Name directory with a variable On 01/20/2012 04:40 PM, Alex Sweps wrote: > Hello Everyone > > Thank you so much for the replies, it now works as it is supposed to :). > I ended up using "Backup\\Test\\#{var1}\\#{var2}" as I find it makes the > code easier to read. While it's probably not important to you at this time, the path you built above will only work on Windows systems, where the file separator character is backslash. A path like that won't work on Unix-like systems such as Linux and OSX. It's a really good idea to use File.join or the pathname library to build your paths rather than directly building path strings. If you do, you don't need to worry about the potential pitfalls if you ever decide to take your script to another platform. The tools should manage the differences for you. Another option is to always use forward slashes, if you really must build the path strings directly. For now at least, forward slashes appear to work on every platform supported by Ruby, including Windows; however, it's possible (if unlikely) that there may one day be a system where this is not the case. Using the tools mentioned above should give you a better chance of being protected in such an event. :-) -Jeremy