3

This line:

dirs = Dir.glob(some_file_path + '/' + '**' + '/')

works as it should on OSX and linux. The same line on Windows:

dirs = Dir.glob(some_file_path + '\\' + '**' + '\\')

returns no directories. What am I doing wrong?

I'm trying to get an array of all of a folders sub folders recursively, and the code above works really nice on a *nix system is there something I need to do differently on windows?

Also note: that on all operating systems I'm using ruby 2.1.5.

almyz125
  • 648
  • 1
  • 7
  • 18

1 Answers1

4

Using the '/' will work on Windows as well (Ruby is smart for this).

daremkd
  • 8,244
  • 6
  • 40
  • 66