Useful Commands 1
This page is mainly an aide-mémoire for me but some of these may be useful for others. Add suggestions for improvements in the comments.
These should all run on bash, additional requirements are noted.
Create a set of test images
This creates a set of images with the numbers 1 to 10 in the middle. Useful for creating a set of images for further scripting tests. Requires ImageMagick.
Single line version
Updated 2014-01-03 to make it compatible with spaces in directory names
This lists subdirectories of the current directory while stripping the closing / making it useful where directory names need to be used as a variable.
Replaces spaces in filenames with underscores for all files (non-hidden files) in the current directory
Unzip archives to individual subdirectoies
Unzips all zip archives in the current directory creating a subfolder for each that is named after the archive (minus the zip extension)
Examples are image renaming but will work with others. Affects all files in the current directory.
Add text between filename and extension. Renames filename.png to filename-text.png
Add text before filename. Renames filename.png to text-filename.png
Batch conversion of SVG files
These convert all SVG files in a directory to EPS or PNG for use with $LaTeX$ etc. This method requires Inkscape.
This script takes an additional argument to determine the resolution (DPI) of the output files. Personally I have it saved in my PATH as svg2png and run as svg2png <DPI>. E.g. “svg2png 300” will export 300 DPI PNG files.