This is a small script to rename multiple files from CAPITAL to small letters. Ok, why we require to do this? Recently we bought a new cam which is naming all photos in capital and it is very much difficult for me to change extension of these photos from caps to small to re-size/modify photos using mogrify Linux tool.
#!/bin/bash
#Author: Surendra Anne
for j in *
do
COUNT=$(ls -1 | wc -l)
if [ $j == $(basename $0) ]
then
echo "can not move the script file which is running this"
else
org_file=$j
new_file=$(echo $j | tr [A-Z] [a-z])
echo "Moving $org_file --> $new_file"
mv $org_file $new_file
fi
done
Comment if there is any issue with this script.
#!/bin/bash
#Author: Surendra Anne
for j in *
do
COUNT=$(ls -1 | wc -l)
if [ $j == $(basename $0) ]
then
echo "can not move the script file which is running this"
else
org_file=$j
new_file=$(echo $j | tr [A-Z] [a-z])
echo "Moving $org_file --> $new_file"
mv $org_file $new_file
fi
done
Comment if there is any issue with this script.
Hello sir,
ReplyDeleteI think there is a typo in your code. I mean after do COUNT=$(ls-1****
It is ls -l, right ?