Recent versions of Ruby support the use of braces in globbing, if you use the File::FNM_EXTGLOB option
From the 2.2.0 documentation
File.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB
However, the 1.9.3 documentation says it isn't supported in 1.9.3:
File.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported
(also, trying to use File::FNM_EXTGLOB
gave a name error)
Is there any way to glob using braces in Ruby 1.9.3, such as a third-party gem?
The strings I want to match against are from S3, not a local file system, so I can't just ask the operating system to do the globbing as far as I know.
File
is able to do the globbing, the OS is able for sure. I bet S3 is mounted or like, so please just try%x|ls c{at,ub}s|
, it should work. – Conduplicate