Forum: Ruby Finding Files recursively on Mac?

Posted by Vince Angeloni (vinnie)
on 2012-11-05 00:12
Using recursive file searches on a Mac results in Ruby digging into
Bundle Apps of all sorts, iCal backups, and plenty of other "Files" on
the Mac which are really folders that get special treatment by the OS
(and which you don't want returned in a recursive file search).

Does anyone have a method which searches recursively but doesn't go into
Application Bundles and others folders which look like files to the Mac
OS?

TIA for any suggestions...
Posted by Ryan Davis (Guest)
on 2012-11-05 00:42
(Received via mailing list)
On Nov 4, 2012, at 15:12 , Vince Angeloni <lists@ruby-forum.com> wrote:

> Does anyone have a method which searches recursively but doesn't go into
> Application Bundles and others folders which look like files to the Mac
> OS?

To do that properly, you need to use NSFileManager to ask if a given 
folder is a bundle or not. You can do that trivially with macruby or use 
the older ruby/objc bridges. It is not fun either way.
Posted by Vince Angeloni (vinnie)
on 2012-11-05 03:51
Ryan Davis wrote in post #1082807:
> To do that properly, you need to use NSFileManager to ask if a given
> folder is a bundle or not. You can do that trivially with macruby or use
> the older ruby/objc bridges. It is not fun either way.

I just dabble with Ruby and I have been striving to pay more attention 
to it and attempting to learn a little MacRuby on the side, but right 
now, most of my programming time is spent flipping between Textmate and 
Ruby documentation looking things up. NSFileManager hasn't even been on 
my radar! But I have a feeling it will be soon. Thanks Ryan, I will see 
what I can accomplish there...
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.