From: David Douthitt Date: 2000-04-21T09:42:48-05:00 Subject: [ruby-talk:02551] Undocumented surprising Dir.glob() behavior It would appear that Dir.glob() will not accept wildcards in the first element of an absolute path. Why this is so I don't know. It doesn't seem to do much since you can still do Dir.chdir("/") then use relative paths..... This behavior is not documented in the 1.4 manual for Dir.glob. Here is the code and a run.... # uname -a HP-UX myhost B.10.20 A 9000/861 2008378618 two-user license # cat test.rb #!/opt/ruby/bin/ruby # ruby 1.4.3 (1999-12-08) [hppa1.1-hpux10.20] # drwxr-xr-x 5 oracle dba 1024 Feb 3 09:38 /u01 # drwxr-xr-x 6 oracle dba 1024 Jan 3 10:19 /u02 # drwxr-xr-x 5 oracle dba 96 Nov 22 17:49 /u03 # drwxr-xr-x 5 oracle dba 96 Dec 23 14:13 /u04 # drwxr-xr-x 5 oracle dba 1024 Nov 20 11:27 /u05 # drwxr-xr-x 7 oracle dba 1024 Dec 2 19:21 /u06 Dir.chdir("/") p Dir.glob("/u0[0-9]/*") p Dir.glob("/u0*") p Dir.glob("/u0?/*") p Dir.glob("/u01/[a-z]*") p Dir.glob("/u01/l[a-z]*") p Dir.glob("/u*") p Dir.glob("/u*/") p Dir.glob("u0[0-9]/*") p Dir.glob("u0*") p Dir.glob("u0?/*") p Dir.glob("u01/[a-z]*") p Dir.glob("u01/l[a-z]*") p Dir.glob("u*") p Dir.glob("u*/") # ./test.rb [] [] [] ["/u01/lost+found", "/u01/loglist", "/u... ["/u01/lost+found", "/u01/loglist", "/u... [] [] ["u06/lost+found", "u06/ARCserve", "u06/data", "u06/oradata... u03/oradata", "u02/lost+found", "u02/data", "u02/ncua", "u0... ["u02", "u03", "u04", "u01", "u05", "u06"] ["u06/lost+found", "u06/ARCserve", "u06/data", "u06/oradata... ["u01/lost+found", "u01/loglist", "u01/cunaccd_export.par",... ["u01/lost+found", "u01/loglist", "u01/listener.ora"] ["usr", "u02", "u03", "u04", "u01", "u05", "u06", "usage.rpt"] ["u06/", "u05/", "u01/", "u04/", "u03/", "u02/", "usr/"]