Run a command across files
Published on
Running a command across multiple files can be achieved using the find command
and its -exec flag.
As an example, this command finds all SVG files within the current directory
(see -maxdepth) and uses Inkscape to export each SVG
file to a PNG:
$ find *.svg -maxdepth 1 -type f -exec inkscape --export-type=png --export-dpi=300 {} \;
{} is the file name returned by the find command and -exec is the command
to run against every file, with \; used to denote the end of the -exec
command.