Finding all VIDEO_TS folders?

Hi. I’m looking for a way to have applescript return a list of the paths to all found folders with the name “VIDEO_TS.” I assumed it would be possible to have applescript do a spotlight search for these folders, but I can’t figure out a way to do it. I also thought maybe applescript could read the “contents/results” of a smart folder that is set to show all VIDEO_TS folders. Again, I can’t figure out any way to do this.

Does anyone have any thoughts on how I can get applescript to find all the paths to VIDEO_TS folders? Thanks for any help!

Hi,

This should return a list of UNIX file paths for all folders called “VIDEO_TS.”.

set myPaths to paragraphs of (do shell script "mdfind \"kMDItemKind == 'Folder' && kMDItemDisplayName == 'VIDEO_TS.'\"")

Best wishes

John M

Thanks John! When I coppied and pasted your example in I wasn’t getting any results. But afeter a few moments I figured out you added a “.” at the end of “VIDEO_TS” :wink:

With that removed it works beautifully! Thank you so much!

Now works:

set myPaths to paragraphs of (do shell script "mdfind \"kMDItemKind == 'Folder' && kMDItemDisplayName == 'VIDEO_TS'\"")

I’m glad it works for you, but you did add the “.”:wink:

John M

I see the confusion… Silly English grammer tells us we’re supposed to add the “.” before quote marks at the end of the sentance, but English grammer doesn’t apply to code. Sorry about the confusion.

If you’re interested in Spotlight queries in scripts, take a look at these pages:

http://developer.apple.com/macosx/spotlight.html (toward the bottom)
http://developer.apple.com/documentation/Carbon/Reference/MetadataAttributesRef/Reference/CommonAttrs.html#//apple_ref/doc/uid/TP40001694
http://developer.apple.com/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html#//apple_ref/doc/uid/TP40001849

Best wishes

John M