mpyidentify
This tool extends the identify package to recognize specific CFD file types and associates them with tags for further processing. It’s particularly useful for analyzing repository contents and identifying files that need special handling.
The identification process:
Scans files and directories recursively
Applies file type detection rules
Recognizes CFD-specific formats (OpenFOAM Foundation software, etc.)
Respects .gitignore and excludes .git directories
Reports unidentified files for review
Provides statistics on file type distribution
Usage
mpyidentify [options] path
Output Format
For each file, the tool prints:
path/to/file: ['tag1', 'tag2', 'tag3']
Example output:
system/controlDict: ['text', 'openfoam', 'dictionary']
0/U: ['text', 'openfoam', 'field']
constant/polyMesh/points: ['text', 'openfoam', 'mesh']
Allrun: ['text', 'shell', 'executable']
README.md: ['text', 'markdown']
Recognized Additional File Types
The tool will also recognize all file types provided by the identify package itself.
Files from OpenFOAM Foundation Software
Dictionary files (controlDict, fvSchemes, fvSolution, etc.)
Field files (U, p, alpha, etc.)
Mesh files (points, faces, owner, neighbour, etc.)
Makefiles (wmake/rules, Make/files, Make/options)
Gitignore Support
The tool automatically respects .gitignore patterns and also ignores:
.git/directory.gitlab/directory.keepfiles
Options
–types
Filter output to show only files matching specified types. Only files that have at least one of the specified types will be displayed.
Example:
mpyidentify --types openfoam,dictionary path/to/case
This shows only files identified as openfoam or dictionary.
Example output:
system/controlDict: ['text', 'openfoam', 'dictionary']
constant/polyMesh/points: ['text', 'openfoam', 'mesh']
–print
Print only the file paths without their associated tags. This is useful for piping the output to other commands or for simpler file listings.
Example:
mpyidentify --print --types openfoam path/to/case
Example output:
system/controlDict
0/U
constant/polyMesh/points
Allrun
README.md
You can combine --print with --types to get a clean list of specific file
types:
mpyidentify --types openfoam --print path/to/case
Example output:
system/controlDict
0/U
constant/polyMesh/points