AI-MicroStructure

 view release on metacpan or  search on metacpan

bin/micro-rename  view on Meta::CPAN

#!/bin/bash
IFS_BAK=$IFS;
IFS=$'\n';

# blank-rename.sh
#
# Substitutes underscores for blanks in all the filenames in a directory.
filename=$1
ONE=1                     # For getting singular/plural right (see below).
number=0                  # Keeps track of how many files actually renamed.
FOUND=0                   # Successful return value.

fname=$1                      # Yes, this filename needs work.
n=`echo $fname | sed -e "s/ /_/g" | sed -e "s/'//g" | sed -e "s/&/and/g"  | tr A-Z a-z | sed -e "s/)/_/g"  | sed -e "s/(/_/g" | sed -e "s/\[//g" | sed -e "s/\]//g"  | sed -e "s/\,//g" | sed -e "s/\;//g"`   #
#        | sed -e "s/[/_/g" | sed -e "s/]//g" | sed -e "s/)//g" | sed -e "s/(//g"`

mv "$1" "$n"       > /dev/null;





IFS=$IFS_BAK;



exit 0



( run in 0.577 second using v1.01-cache-2.11-cpan-a5abf4f5562 )