MacOS – Find files in Terminal by kind – not extension

command linemacosterminal

I have about 50,000 files in a folder tree which show up as the correct "Kind" in Finder ("Sound Designer II audio") but which have no extension.

I want to find all these and rename them to *.sd2 in Terminal.

Can the find command be used to find by "kind" without any extension?

Best Answer

To search all files with a distinctive kind use the command:

mdfind 'kMDItemKind="Sound Designer II audio"'

If this is not sufficient you can also use the type code (yyyy below is a place holder only)

mdfind 'kMDItemFSTypeCode="yyyy"'

You should be able get an (unknown) type code of a Sound Designer II audio file by executing mdls "/path/to/Sound Designer II audio file" | grep kMDItemFSTypeCode