T
timr
I just noticed the Unix find command is a bit more thorough than
Dir.glob. The difference is that find looks in hidden directories
(.directories), while Dir.glob doesn't. Here is a demonstration:
Tim:~/Desktop/test> ls -la
total 0
drwxr-xr-x 3 Tim staff 102 Feb 27 01:07 .
drwx------+ 154 Tim staff 5236 Feb 27 01:06 ..
drwxr-xr-x 2 Tim staff 68 Feb 27 01:06 .gem
Tim:~/Desktop/test> cd .gem
Tim:~/Desktop/test/.gem> cat > findme.rb
Tim:~/Desktop/test/.gem> ls
findme.rb
Tim:~/Desktop/test/.gem> cd ..
Tim:~/Desktop/test> find . -name '*.rb' -print
../.gem/findme.rb
Tim:~/Desktop/test> ruby -e 'Dir.glob("**/*.rb")'
Tim:~/Desktop/test>
So is there a way to get glob to additionally look inside
of .directories?
Alternatively, if you know of another pure and elegant way of finding
all files recursively, even in dot directories perhaps with File or
something, I would greatly appreciate an example.
Thanks,
Tim
Dir.glob. The difference is that find looks in hidden directories
(.directories), while Dir.glob doesn't. Here is a demonstration:
Tim:~/Desktop/test> ls -la
total 0
drwxr-xr-x 3 Tim staff 102 Feb 27 01:07 .
drwx------+ 154 Tim staff 5236 Feb 27 01:06 ..
drwxr-xr-x 2 Tim staff 68 Feb 27 01:06 .gem
Tim:~/Desktop/test> cd .gem
Tim:~/Desktop/test/.gem> cat > findme.rb
Tim:~/Desktop/test/.gem> ls
findme.rb
Tim:~/Desktop/test/.gem> cd ..
Tim:~/Desktop/test> find . -name '*.rb' -print
../.gem/findme.rb
Tim:~/Desktop/test> ruby -e 'Dir.glob("**/*.rb")'
Tim:~/Desktop/test>
So is there a way to get glob to additionally look inside
of .directories?
Alternatively, if you know of another pure and elegant way of finding
all files recursively, even in dot directories perhaps with File or
something, I would greatly appreciate an example.
Thanks,
Tim