Why I need it is simple- I need to show/count how many "user" files are in the 
folder, to the users. I'm migrating an Applescript based app to Cocoa.
I believe I neglected to mention that the folder I am looking at is on a 
Windows server, so any native-ignoring of .DS files might not work. But as I 
use the command, I can see that my count is "1" when really it should be "0" 
but doing terminal ls -A reveals hidden files to me.

I think I might try getting every file name of the folder, and then removing 
any file named ".DS_Store" or starts with ._ etc from the list, then counting 
that revised list. I'm working in a controlled environment at my office and I 
know these folders won't have more than say 100 items at a time, so time spent 
in a loop isn't a big factor for me.

Thanks Kirk...
ignoring invisible files
> Determining file visibility is tricky. There are at least
> three different ways that a file can be made invisible, and
> no one API that is guaranteed to test all of them.
> 
> 
> Sample code from online (not by me)
> 
> BOOL isInvisibleCFURL(CFURLRef inURL)
> {
> LSItemInfoRecord itemInfo;
> LSCopyItemInfoForURL(inURL, kLSRequestAllFlags,
> &itemInfo);
> 
> BOOL isInvisible = itemInfo.flags &
> kLSItemInfoIsInvisible;
> return isInvisible;
> }
> 
> To convert this into a category on NSString so you can use
> a simple filter on an array of file paths:
> (COMPOSED IN MAIL)
> 
> - (BOOL) isVisibleItem
> {
> NSURL * url = [NSURL fileURLWithString: self];
> return !isInvisibleCFURL(url);
> }
> 
> This is simplistic, but it should work in the vast majority
> of cases.
> 
> I suppose the other question is -- why are you ignoring
> invisible files?



      

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to