On Nov 17, 2008, at 11:21 AM, Bil Kleb wrote: > Hi, > > I can't find a Ruby equivalent to > > find . -perm -g+rw -ls > > Currently, it looks like I'll need to combine, > > File.stat(file).mode > > with something like Hal Fulton's sym2oct, > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/96956 > > hacked into Daniel Berger's file-find gem, > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/248981 > > and require 'etc' to pull out the user and group names instead of uids > and gids? > > Is there an alternative to all this yak shaving? maybe something like this? rolando:test_perm rolando$ ls -l total 8 -rw-rw-r-- 1 rolando staff 0 Nov 17 12:12 1 -rw-r--r-- 1 rolando staff 0 Nov 17 12:13 2 -rw-r--r-- 1 rolando staff 77 Nov 17 12:21 perm.rb rolando:test_perm rolando$ find . -perm -g+rw -ls 1510804 0 -rw-rw-r-- 1 rolando staff 0 Nov 17 12:12 ./1 rolando:test_perm rolando$ ruby perm.rb ["./1"] rolando:test_perm rolando$ cat perm.rb # NOTE: 060 == g+rw p Dir["./**/*"].select { |f| File.stat(f).mode & 060 == 060 ? true : nil } > Thanks, > -- > http://twitter.com/bil_kleb regards, -- Rolando Abarca M.