[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] file-find 0.1.0

Daniel Berger

4/24/2007 5:16:00 PM

Hi all,

I'm happy to announce the first release of file-find. This package is
meant as a replacement for the current 'find' module in the Ruby
standard library. It provides many more options for controlling the
behavior of your find operations.

It is modelled on the 'find' command typically found on Unix systems.

Example1:

# Look for all .rb files changed in the last 24 hours
rule = File::Find.new(:name => "*.rb", :ctime => 0)
rule.find{ |file| puts file }

# Look for all text files owned by user id 23, don't follow symlinks
rule = File::Find.new(:name => "*.txt", :user => 23, :follow => false)
rule.find{ |file| puts file }

You can find install the file-find package as a gem, or grab the file
from the project page at http://rubyforge.org/projec.... You
can also find it on the RAA.

Enjoy!

Dan

15 Answers

Leslie Viljoen

4/24/2007 6:22:00 PM

0

On 4/24/07, Daniel Berger <djberg96@gmail.com> wrote:
> Hi all,
>
> I'm happy to announce the first release of file-find. This package is
> meant as a replacement for the current 'find' module in the Ruby
> standard library. It provides many more options for controlling the
> behavior of your find operations.
>
> It is modelled on the 'find' command typically found on Unix systems.
>
> Example1:
>
> # Look for all .rb files changed in the last 24 hours
> rule = File::Find.new(:name => "*.rb", :ctime => 0)
> rule.find{ |file| puts file }
>
> # Look for all text files owned by user id 23, don't follow symlinks
> rule = File::Find.new(:name => "*.txt", :user => 23, :follow => false)
> rule.find{ |file| puts file }
>
> You can find install the file-find package as a gem, or grab the file
> from the project page at http://rubyforge.org/projec.... You
> can also find it on the RAA.

Woo! Thanks!
One question: what happens when you iterate over a directory you do
not have permission to read? Rio throws an exception and exits,
meaning the remaining files are skipped, which is not cool. I tried to
provide an option to skip forbidden directories, but Rio is a bit
convoluted.

Daniel Berger

4/24/2007 8:36:00 PM

0

On 4/24/07, Leslie Viljoen <leslieviljoen@gmail.com> wrote:
> On 4/24/07, Daniel Berger <djberg96@gmail.com> wrote:
> > Hi all,
> >
> > I'm happy to announce the first release of file-find. This package is
> > meant as a replacement for the current 'find' module in the Ruby
> > standard library. It provides many more options for controlling the
> > behavior of your find operations.
> >
> > It is modelled on the 'find' command typically found on Unix systems.
> >
> > Example1:
> >
> > # Look for all .rb files changed in the last 24 hours
> > rule = File::Find.new(:name => "*.rb", :ctime => 0)
> > rule.find{ |file| puts file }
> >
> > # Look for all text files owned by user id 23, don't follow symlinks
> > rule = File::Find.new(:name => "*.txt", :user => 23, :follow => false)
> > rule.find{ |file| puts file }
> >
> > You can find install the file-find package as a gem, or grab the file
> > from the project page at http://rubyforge.org/projec.... You
> > can also find it on the RAA.
>
> Woo! Thanks!
> One question: what happens when you iterate over a directory you do
> not have permission to read? Rio throws an exception and exits,
> meaning the remaining files are skipped, which is not cool. I tried to
> provide an option to skip forbidden directories, but Rio is a bit
> convoluted.

It skips them. :)

Regards,

Dan

Leslie Viljoen

4/24/2007 8:49:00 PM

0

On 4/24/07, Daniel Berger <djberg96@gmail.com> wrote:
> On 4/24/07, Leslie Viljoen <leslieviljoen@gmail.com> wrote:
> > On 4/24/07, Daniel Berger <djberg96@gmail.com> wrote:
> > > Hi all,
> > >
> > > I'm happy to announce the first release of file-find. This package is
> > > meant as a replacement for the current 'find' module in the Ruby
> > > standard library. It provides many more options for controlling the
> > > behavior of your find operations.
> > >
> > > It is modelled on the 'find' command typically found on Unix systems.
> > >
> > > Example1:
> > >
> > > # Look for all .rb files changed in the last 24 hours
> > > rule = File::Find.new(:name => "*.rb", :ctime => 0)
> > > rule.find{ |file| puts file }
> > >
> > > # Look for all text files owned by user id 23, don't follow symlinks
> > > rule = File::Find.new(:name => "*.txt", :user => 23, :follow => false)
> > > rule.find{ |file| puts file }
> > >
> > > You can find install the file-find package as a gem, or grab the file
> > > from the project page at http://rubyforge.org/projec.... You
> > > can also find it on the RAA.
> >
> > Woo! Thanks!
> > One question: what happens when you iterate over a directory you do
> > not have permission to read? Rio throws an exception and exits,
> > meaning the remaining files are skipped, which is not cool. I tried to
> > provide an option to skip forbidden directories, but Rio is a bit
> > convoluted.
>
> It skips them. :)

Yummy! Downloading now...

Leslie Viljoen

4/24/2007 10:16:00 PM

0

On 4/24/07, Servando Garcia <garcia.servando@gmail.com> wrote:
>
> Sweet I want one. Where's the download link?
>
>
> > On 4/24/07, Leslie Viljoen wrote:
>
> >
> >> On 4/24/07, Daniel Berger wrote:
> >>
> >>> Hi all,
> >>>
> >>> I'm happy to announce the first release of file-find. This
> >>> package is meant as a replacement for the current 'find' module
> >>> in the Ruby standard library. It provides many more options for
> >>> controlling the behavior of your find operations.

Can you find directories with this?

#!/usr/local/bin/ruby

require 'rubygems'
require 'yaml'
require 'file/find'

finder = File::Find.new(:name => '*', :path => '/etc', :ftype => 'directory')
finder.find{|d| p d}

--gives me nothing.

Les

Daniel Berger

4/24/2007 10:36:00 PM

0



On Apr 24, 4:15 pm, "Leslie Viljoen" <leslievilj...@gmail.com> wrote:
> On 4/24/07, Servando Garcia <garcia.serva...@gmail.com> wrote:
>
>
>
> > Sweet I want one. Where's the download link?
>
> > > On 4/24/07, Leslie Viljoen wrote:
>
> > >> On 4/24/07, Daniel Berger wrote:
>
> > >>> Hi all,
>
> > >>> I'm happy to announce the first release of file-find. This
> > >>> package is meant as a replacement for the current 'find' module
> > >>> in the Ruby standard library. It provides many more options for
> > >>> controlling the behavior of your find operations.
>
> Can you find directories with this?
>
> #!/usr/local/bin/ruby
>
> require 'rubygems'
> require 'yaml'
> require 'file/find'
>
> finder = File::Find.new(:name => '*', :path => '/etc', :ftype => 'directory')
> finder.find{|d| p d}
>
> --gives me nothing.

That would be a bug. Please file it on the RubyForge project page so I
don't forget.

Thanks,

Dan


Daniel Berger

4/25/2007 1:01:00 AM

0

Leslie Viljoen wrote:
> On 4/24/07, Servando Garcia <garcia.servando@gmail.com> wrote:
>>
>> Sweet I want one. Where's the download link?
>>
>>
>> > On 4/24/07, Leslie Viljoen wrote:
>>
>> >
>> >> On 4/24/07, Daniel Berger wrote:
>> >>
>> >>> Hi all,
>> >>>
>> >>> I'm happy to announce the first release of file-find. This
>> >>> package is meant as a replacement for the current 'find' module
>> >>> in the Ruby standard library. It provides many more options for
>> >>> controlling the behavior of your find operations.
>
> Can you find directories with this?
>
> #!/usr/local/bin/ruby
>
> require 'rubygems'
> require 'yaml'
> require 'file/find'
>
> finder = File::Find.new(:name => '*', :path => '/etc', :ftype =>
> 'directory')
> finder.find{|d| p d}
>
> --gives me nothing.

Nevermind about the bug report. It's fixed in CVS. :)

Thanks,

Dan


Leslie Viljoen

4/25/2007 10:55:00 AM

0

On 4/25/07, Daniel Berger <djberg96@gmail.com> wrote:
> Leslie Viljoen wrote:
> > On 4/24/07, Servando Garcia <garcia.servando@gmail.com> wrote:
> >>
> >> Sweet I want one. Where's the download link?
> >>
> >>
> >> > On 4/24/07, Leslie Viljoen wrote:
> >>
> >> >
> >> >> On 4/24/07, Daniel Berger wrote:
> >> >>
> >> >>> Hi all,
> >> >>>
> >> >>> I'm happy to announce the first release of file-find. This
> >> >>> package is meant as a replacement for the current 'find' module
> >> >>> in the Ruby standard library. It provides many more options for
> >> >>> controlling the behavior of your find operations.
> >
> > Can you find directories with this?
> >
> > #!/usr/local/bin/ruby
> >
> > require 'rubygems'
> > require 'yaml'
> > require 'file/find'
> >
> > finder = File::Find.new(:name => '*', :path => '/etc', :ftype =>
> > 'directory')
> > finder.find{|d| p d}
> >
> > --gives me nothing.
>
> Nevermind about the bug report. It's fixed in CVS. :)

Thanks for that, it works very well now.
:-)

Daniel Berger

4/26/2007 3:46:00 PM

0

On Apr 25, 4:55 am, "Leslie Viljoen" <leslievilj...@gmail.com> wrote:
> On 4/25/07, Daniel Berger <djber...@gmail.com> wrote:
>
>
>
> > Leslie Viljoen wrote:
> > > On 4/24/07, Servando Garcia <garcia.serva...@gmail.com> wrote:
>
> > >> Sweet I want one. Where's the download link?
>
> > >> > On 4/24/07, Leslie Viljoen wrote:
>
> > >> >> On 4/24/07, Daniel Berger wrote:
>
> > >> >>> Hi all,
>
> > >> >>> I'm happy to announce the first release of file-find. This
> > >> >>> package is meant as a replacement for the current 'find' module
> > >> >>> in the Ruby standard library. It provides many more options for
> > >> >>> controlling the behavior of your find operations.
>
> > > Can you find directories with this?
>
> > > #!/usr/local/bin/ruby
>
> > > require 'rubygems'
> > > require 'yaml'
> > > require 'file/find'
>
> > > finder = File::Find.new(:name => '*', :path => '/etc', :ftype =>
> > > 'directory')
> > > finder.find{|d| p d}
>
> > > --gives me nothing.
>
> > Nevermind about the bug report. It's fixed in CVS. :)
>
> Thanks for that, it works very well now.
> :-)

I just put out 0.2.0 today. This version adds "prune" and "perm", as
well as fixes a bug where subdirectories weren't being traversed.

Regards,

Dan

Bernard Kenik

4/27/2007 3:58:00 AM

0

On Apr 26, 11:45 am, Daniel Berger <djber...@gmail.com> wrote:
> On Apr 25, 4:55 am, "Leslie Viljoen" <leslievilj...@gmail.com> wrote:
>
>
>
>
>
> > On 4/25/07, Daniel Berger <djber...@gmail.com> wrote:
>
> > > Leslie Viljoen wrote:
> > > > On 4/24/07, Servando Garcia <garcia.serva...@gmail.com> wrote:
>
> > > >> Sweet I want one. Where's the download link?
>
> > > >> > On 4/24/07, Leslie Viljoen wrote:
>
> > > >> >> On 4/24/07, Daniel Berger wrote:
>
> > > >> >>> Hi all,
>
> > > >> >>> I'm happy to announce the first release of file-find. This
> > > >> >>> package is meant as a replacement for the current 'find' module
> > > >> >>> in the Ruby standard library. It provides many more options for
> > > >> >>> controlling the behavior of your find operations.
>
> > > > Can you find directories with this?
>
> > > > #!/usr/local/bin/ruby
>
> > > > require 'rubygems'
> > > > require 'yaml'
> > > > require 'file/find'
>
> > > > finder = File::Find.new(:name => '*', :path => '/etc', :ftype =>
> > > > 'directory')
> > > > finder.find{|d| p d}
>
> > > > --gives me nothing.
>
> > > Nevermind about the bug report. It's fixed in CVS. :)
>
> > Thanks for that, it works very well now.
> > :-)
>
> I just put out 0.2.0 today. This version adds "prune" and "perm", as
> well as fixes a bug where subdirectories weren't being traversed.
>
> Regards,
>
> Dan- Hide quoted text -
>
> - Show quoted text -

Can find the file-find gem but cannot install it.

C:\Documents and Settings\Owner>gem query -n file-find -r

*** REMOTE GEMS ***

file-find (0.2.0, 0.1.1, 0.1.0)
A better way to find files


C:\Documents and Settings\Owner>gem install file-find
ERROR: While executing gem ... (OpenURI::HTTPError)
404 Not Found

Regards

bbiker

Daniel Berger

4/27/2007 4:49:00 AM

0



On Apr 26, 10:00 pm, bbiker <ren...@nc.rr.com> wrote:
> On Apr 26, 11:45 am, Daniel Berger <djber...@gmail.com> wrote:
>
>
>
> > On Apr 25, 4:55 am, "Leslie Viljoen" <leslievilj...@gmail.com> wrote:
>
> > > On 4/25/07, Daniel Berger <djber...@gmail.com> wrote:
>
> > > > Leslie Viljoen wrote:
> > > > > On 4/24/07, Servando Garcia <garcia.serva...@gmail.com> wrote:
>
> > > > >> Sweet I want one. Where's the download link?
>
> > > > >> > On 4/24/07, Leslie Viljoen wrote:
>
> > > > >> >> On 4/24/07, Daniel Berger wrote:
>
> > > > >> >>> Hi all,
>
> > > > >> >>> I'm happy to announce the first release of file-find. This
> > > > >> >>> package is meant as a replacement for the current 'find' module
> > > > >> >>> in the Ruby standard library. It provides many more options for
> > > > >> >>> controlling the behavior of your find operations.
>
> > > > > Can you find directories with this?
>
> > > > > #!/usr/local/bin/ruby
>
> > > > > require 'rubygems'
> > > > > require 'yaml'
> > > > > require 'file/find'
>
> > > > > finder = File::Find.new(:name => '*', :path => '/etc', :ftype =>
> > > > > 'directory')
> > > > > finder.find{|d| p d}
>
> > > > > --gives me nothing.
>
> > > > Nevermind about the bug report. It's fixed in CVS. :)
>
> > > Thanks for that, it works very well now.
> > > :-)
>
> > I just put out 0.2.0 today. This version adds "prune" and "perm", as
> > well as fixes a bug where subdirectories weren't being traversed.
>
> > Regards,
>
> > Dan- Hide quoted text -
>
> > - Show quoted text -
>
> Can find the file-find gem but cannot install it.
>
> C:\Documents and Settings\Owner>gem query -n file-find -r
>
> *** REMOTE GEMS ***
>
> file-find (0.2.0, 0.1.1, 0.1.0)
> A better way to find files
>
> C:\Documents and Settings\Owner>gem install file-find
> ERROR: While executing gem ... (OpenURI::HTTPError)
> 404 Not Found

Strange. I just tried a remote install and it worked fine. Try again
later. Perhaps you'll need to delete your gem cache.

Regards,

Dan