A bash script that replaces spaces, +, and certain invalid characters in filenames with underscores. It processes all files in a directory.
Run the following command to download and make the script executable:
curl -sSL "https://gist.zod.tf/4bb1596111018a3d086b6e031ba64c98/raw/cleanFilenames.sh" -o cleanFilenames.sh && chmod +x cleanFilenames.sh
The script takes one optional argument: the directory of files to rename. If no directory is specified, the script defaults to the current working directory.
./cleanFilenames.sh # Rename files in the current directory
./cleanFilenames.sh /path/to/dir # Rename files in /path/to/dir
For getting help:
./cleanFilenames.sh --help
./cleanFilenames.sh -h