Splitting mdls shell results

[code] dim f as new FolderItem
dim sh as new Shell

sh.Execute "mdls -name kMDItemFSLabel -name kMDItemFSName -raw " + f.ShellPath

Hi guys,

I’m getting two values from a mdls shell. Is there a way to return the results with a space or endofline etc. before it’s written to the textarea?


according to MAN, there is a NULL char between results

so (untested)


you could also use split() or nthfield() to get the values.

Brilliant…Thanks guys!!


Pardon my ignorance if I’m missing something here. SpotlightQuery seems like it’d be the better choice as it wraps up all this functionality cleanly.

What’s the advantage to using Shell over SpotlightQuery?

SpotlightQuery searches for files & [quote]mdls – lists the metadata attributes for the specified file[/quote] taken from manual page for mdls…two different things.

The shell version of SpotlightQuery:
mdfind has the ability to limit the search to a given directory with the -onlyin option…which you can’t do with SpotlightQuery.