(Download) - (Source Code) - (Using It)
(Todo) - (Change Log)

This BASH script is named bm.sh because it is sort of like a bowel movement. It removes the waste that causes disorder in your directories. That waste is bad file names and capitolized file extensions.

The script moves all files ending in .JPG to .jpg. It also gives you the option to name each file with a common name and then number them so that each batch of JPG files is separated from the others. Below is an example of what this script can do at the moment. This script is still in its infancy and will be expanded on, again, in the near future.

name.JPG (and .jpg) can be changed to the following: name.1.jpg or name.jpg

In the examples above name can be the original name of the file or a common name that is given to each JPG file followed by a number which differentiates that file from the rest. Like so:

commonName.1.jpg
commonName.2.jpg
commonName.3.jpg
otherName.1.jpg
otherName.2.jpg
…and so on…

Using The Script

There is no installation necessary. Simply download the script and run chmod 755 bm.sh to make the file executable but not writable.

To run the script you simply enter ./bm.sh into the shell.

Todo

  • Read an entire tutorial on how to write scripts.
  • Create a second mode: Text line Mode.
  • Clean up the code, using functions and cases.

Change Log

  • Added extra error handling for file names.

  • Removed unesesary if statements.
  • Added error checking to test whether user input is numeric.
  • Corrected problems with the renaming of files which contain spaces.