changed Dir[pattern] to Dir.glob(pattern)