Algosim documentation: FileExt

FileExt

Extracts the file extension from a file name (fully qualified or not).

Syntax

Description

If s is a file name, fully qualified or not, then FileExt(s) returns the file extension of the file name, if there is one. If so, the result includes the leading full stop character. If not, the empty string is returned.

Examples

WordWrap(join(sort(unique(FileList("C:\WINDOWS\System32") @ FileExt))))
.acm, .ax, .bpl, .cat, .CHS, .CHT, .cmd, .com, .cpl, .cpx, .DAT, .dat, .DLL,
.dLL, .dll, .drv, .dtd, .EXE, .exe, .h, .ico, .iec, .IME, .ime, .inf, .INI,
.jdbg, .jpn, .json, .kor, .lex, .log, .mlp, .mof, .MSC, .msc, .nfo, .NLS, .nls,
.OCX, .ocx, .OLB, .rat, .rll, .rs, .rsp, .rtf, .scr, .sdi, .sep, .sys, .tbl,
.THA, .tlb, .tsp, .uce, .vbs, .xml, .xsl

Note: In theory, this is more performant:

WordWrap(join(RemoveAdjacentDuplicates(sort(FileList("C:\WINDOWS\System32") @ FileExt))))
first(SortBy(frequencies(FileList("C:\WINDOWS\System32") @ FileExt), (x ↦ −x[2])), 10)
(.dll, 1642)
(.exe, 287)
(.DLL, 225)
(.NLS, 112)
(.bpl, 40)
(.jdbg, 26)
(.cpl, 20)
(.ax, 19)
(.rs, 15)
(.log, 14)

See also