Hi,
I have a strange problem with Dir.glob and directory symlinks on linux.
There's a directory:
$ ls -l /tmp/test
drwxr-xr-x 2 sdmitry sdmitry 80 Sep 13 10:40 test1
drwxr-xr-x 2 sdmitry sdmitry 80 Sep 13 10:40 test2
lrwxrwxrwx 1 sdmitry sdmitry 8 Sep 13 10:40 test3 -> ../test3
Each sub-directory has files with .file extension. Here's the problem:
$ ruby -e "p Dir.glob('**/*.file')"
["test1/test.file", "test2/test2.file"]
Why there's no test3 files in the result? And what simple workaround can I use
to get:
["test1/test.file", "test2/test2.file", "test3/test3.file"]
Thanks in advance,
···
--
sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.
Spam Here -> postmaster@sco.com
Hi,
At Mon, 13 Sep 2004 11:53:11 +0900,
Dmitry V. Sabanin wrote in [ruby-talk:112357]:
I have a strange problem with Dir.glob and directory symlinks on linux.
There's a directory:
$ ls -l /tmp/test
drwxr-xr-x 2 sdmitry sdmitry 80 Sep 13 10:40 test1
drwxr-xr-x 2 sdmitry sdmitry 80 Sep 13 10:40 test2
lrwxrwxrwx 1 sdmitry sdmitry 8 Sep 13 10:40 test3 -> ../test3
Each sub-directory has files with .file extension. Here's the problem:
$ ruby -e "p Dir.glob('**/*.file')"
["test1/test.file", "test2/test2.file"]
Why there's no test3 files in the result? And what simple workaround can I use
to get:
["test1/test.file", "test2/test2.file", "test3/test3.file"]
"**" doesn't traverse symbolic links, or it can cause an
infinite loop.
$ ruby -e "p Dir.glob('*/**/*.file')"
["test1/test1.file", "test2/test2.file", "test3/test3.file"]
···
--
Nobu Nakada