Is it possible for Directory Opus upon opening a directory to tell if a file has the wrong extension. Just an idea as most files hold this information. I have loads of files and over the years people send me a file with wrong extension and that can cause problems. Is this possible or something that can be added?
For which file types?
Are you looking for something like the file command on Linux?
On Windows, you can use trid. it's easy to integrate it into Opus ![]()
Like Trid, But I thought it would be great to have one integrated into Directory Opus rather than an external plugin and one that can ask if you want to change the file type extension for you. Thought it would be something Directory opus might like to add themselves.
If you're thinking about something generic (e.g. that would work for any filetype), this has some serious drawbacks, mainly coming from the fact that most filetypes are identified by the first bytes inside the file (sometimes with some complexity). So it would require:
- To read something like 32/64 bytes of every file in every folder you'd open. This would have an impact on performance, especially with large folders.
- Directory Opus to implement (and update) all the filetypes magic numbers (those first bytes) in order to be able to compare them to the extension provided.
IMHO, you're better off targetting the most frequent filetypes people are sending you with wrong extension, and put in place a way to check only these files, triggering that with a user action (a button, a column).
As an example of this, you can have a look at a small include script I shared recently that checks a file extension against its magic number for common image file types ... Include script for image type detection based on magic numbers
You could do all file types or just images. As it is mainly images that I get sent with wrong extensions
A lot of things are really zip files but with a different extension. Would you really want to "fix" those extensions? You would, for example, break all your Opus config backup files (really zips, but should have a .ocb extension).
That's possible, at least for the types Opus recognizes. Would require a little scripting (or maybe creative use of Evaluator code in a rename preset).
(Even then, there are some images which have "wrong" extensions on purpose, or ones that can have multiple extensions for the same data, depending on how the file is intended to be used.)
Making a button that runs Trid is the easiest solution, since you just have to make a simple button and everything else is already done for you. (In fact, I think there are already buttons for it on the forum.)
The reason you would want to fix files with incorrect extensions is to prevent some apps/ software trying to open them. just useful I thought. You could exclude certain file types if as you said Directory opus has its own zip extension.