File type problem

Posted:
Sat Sep 02, 2023 5:52 am
by Trickyt57
I accidentally renamed thousands of files with the extension .pdf
These files originally had extensions like .doc, .xlsx, .mov, .jpeg, .mp4, and .pdf
How can I use Hazel to determine the file type? I have tried using "Kind ...is...." and "Kind... is not..." type rules, but these seem to just assume everything is a pdf file because of the extension.
I was hoping to find a "type is" rule.
Re: File type problem

Posted:
Mon Sep 04, 2023 8:47 am
by Mr_Noodle
You'll probably need a script for this. There is the 'file' command which can try to figure out the type based on the file's contents.
Re: File type problem

Posted:
Wed Sep 06, 2023 4:24 pm
by Trickyt57
Hmmm... Scripts sound scary, I'm not sure where to start. I tried looking through this forum for s scripts tuorial, but I couldn't find any. I've no clue what the difference is between the different types of scripts. - Passes AppleScript , Passes JavaScript
Passes shell script etc.
Also I couldn't any "file comand in Hazel.
Re: File type problem

Posted:
Thu Sep 07, 2023 8:32 am
by Mr_Noodle
It's in macOS, not Hazel. Here's a manual for the 'file' program. It's a bit more technical but should give you a sense of what it does:
https://ss64.com/osx/file.html
Re: File type problem

Posted:
Tue Sep 12, 2023 10:57 am
by Trickyt57
Mr_Noodle wrote:It's in macOS, not Hazel. Here's a manual for the 'file' program. It's a bit more technical but should give you a sense of what it does:
https://ss64.com/osx/file.html
Many thanks for pointing me in the direction of this script! As you say, it looks daunting but I suppose I could learn it with some effort.