... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2008-04-18

Determine File Extensions in Use

The following Mathematica code defines a function that lists all of the file extensions in use in a directory tree:

FileExtensionsInUse[directory_] := Module[{pattern="."~~Except["."|$PathnameSeparator]..~~EndOfString},
  StringCases[#, x:pattern:>x] /. {{}->"", {x_}:>x} & /@
  Select[FileNames["*", directory, Infinity], !StringFreeQ[#, pattern]&] //
  Union
]

Blog Archive