Fix File Extension
Reads what a file actually contains and, where that contradicts its extension, renames it with the extension its type normally carries — a PDF saved as .dat becomes .pdf. Useful when a source system hands off files with wrong or missing extensions.
Inputs
Section titled “Inputs”- Input File or Directory — a file, or a folder whose files are each checked, in a document account. Files are renamed where they are, so there is no output location.
How It Works
Section titled “How It Works”The step identifies each file’s type from its contents, and renames the file only when its current name is missing an extension, has a placeholder one (.dat, .tmp or .bin), or names a different type the step recognises.
The types it recognises are PDF; JPEG, PNG, GIF, TIFF, BMP, WebP and HEIC images; Excel (.xlsx, .xls), Word (.docx, .doc) and PowerPoint (.pptx) documents; ZIP and GZip archives; and CSV, JSON, HTML, XML and plain text.
A file keeps its name when:
- its extension already fits its contents —
.jpgand.jpegboth fit a JPEG,.tifand.tiffa TIFF; - its extension is one the step doesn’t recognise, such as
.sql,.logor.ai, because contents alone cannot tell a SQL script from any other text, or an Illustrator file from a PDF; - it holds plain text under a text extension such as
.csv,.tsvor.json; - it holds one text format under another’s extension — XML in a
.htmlfile, CSV in a.jsonfile — because contents can’t reliably tell those apart. Only a.txtfile, or one with no or a placeholder extension, is renamed to a text format; - it is a ZIP file named as an Office document, since
.xlsx,.docxand.pptxfiles are ZIP files inside; - its type cannot be determined, as for an empty file.
An archive is judged by its own contents: its members are not opened or renamed. Files whose names start with . are skipped.
Examples
Section titled “Examples”| File | Contents | Result |
|---|---|---|
invoice.dat |
renamed invoice.pdf |
|
photo.png |
JPEG | renamed photo.jpg |
export.txt |
CSV | renamed export.csv |
readme |
plain text | renamed readme.txt |
query.sql |
plain text | unchanged |
budget.xlsx |
ZIP | unchanged |
- If the input path does not exist or has no files in it, the step finishes with a warning that names the path and processes nothing, and the workflow continues.