I have folders, containing files and folders. Among these files, some have extension, some have no extension.

I noticed that a file without extension can have a type (probably stored in some kind of metadata)

Example of a TextEdit file without extension :

enter image description here

Example of a Document Sublime Text file without extension :

enter image description here

What I want is recursively exploring folders and changing the type of files without extension.

I am not talking about setting a default app for all files without extension.

I am talking about changing each file individually (metadata), to set there type to "Document Sublime Text"

I am looking for something like that :

find ./ -depth <file has no extension> -exec <set file type = Document Sublime Text>

Or an AppleScript !

1 Answer 1


I did it with xattr ! My final script is :

find FOLDER -type f ! -name "*.*" -print0 | xargs -0 xattr -wx com.apple.LaunchServices.OpenWith \
"`xattr -px com.apple.LaunchServices.OpenWith FILEWITHGOODTYPE`"

Replace FOLDER by your folder (containing files without extension) (drag and drop)

Replace FILEWITHGOODTYPE by a file which has the expected type (drag and drop)

I found what I was looking for here :


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .