Posted on 05-01-2014 08:47 AM
Is there a way in the JSS (Smart Groups) or otherwise to do an Inventory on filetype / extension?
In this case to find .mkv files
thx in advance,
john
Posted on 05-01-2014 09:46 AM
The Casper Suite's core functions aren't really designed to inventory files and folders on Macs. It does have a function for finding files in the Run Command section, but I don't particularity ever use that, so I can't say how reliable it is. Even if it works, I believe it only shows you results in the policy or Casper Remote log and isn't something you could use to build a Smart group from.
Your best bet will be to craft an Extension Attribute script. I'm not sure if you're just looking for a listing of all files of a certain type (the .mkv you mentioned) or if you just need to know if any mkv files exist on a Mac, like a simple Yes/No result. The latter would be easier, but its also possible to set up an EA that would create a list of all the files on the system of that type.
Does that help?
Posted on 05-01-2014 09:52 AM
thanks so much for the quick reply.
Looks like an EA (extension attribute) script, to get a listing of all files (in this case, .mkv) files, and the amount of the files, size wise). Basically who has possibly non business related video files. Where and how for such an EA script.
thanks again,
John
Posted on 05-01-2014 10:19 AM
Hey John!
Best way to do this is to use an EA to sort through specific directories and then base a smart group off the results.
Posted on 05-01-2014 10:24 AM
Matt,
What's up, hope all is well.
Sounds like a plan, will do, and thx.
john
Posted on 05-01-2014 10:26 AM
As long as you don't expect any of these files to be located in strange places, or in very deep folders in the OS, I would recommend using mdfind for this, since the results will populate much faster than using the standard Unix find command. 'find' is good at locating files literally anywhere, but it can be very slow.
Mdfind (command line Spotlight) is good at finding files of a certain type regardless of what extension is on them, so for example. a user couldn't actually easily hide a file from Spotlight. But it doesn't index many System level directories by default, and since mdfind uses the Spotlight index for searches, it wouldn't see anything in those folders.
#!/bin/sh
echo "<result>$( mdfind -onlyin /Users/ 'kMDItemKind == "Matroska Video File"' )</result>"
Update: I was apparently wrong. If I remove the actual file extension in the Finder (not just hide it) Spotlight can no longer find it, because the OS now sees the file as a plain document, not as a mkv or other file format. So looks like the file can actually be hidden from the search just by renaming it. Just something to keep in mind.
Posted on 05-01-2014 10:34 AM
Something like this might work to find any file that spotlight has indexed with a certain extension:
#!/bin/sh
echo "<result>$( mdfind .mkv )</result>"
Posted on 03-09-2015 01:43 PM
Hey guys - I've been looking for an EA to search multiple media file formats based on file extension only. I have a simple find command (contained in a shell script) that seems to work stand-alone but having syntax issues trying to construct an EA out of it:
find . | grep -i "..mkv$|.avi$|.mpg$|.mp4$" > medialog.txt
Thanks in advance.