I am trying to bulk rename many folders but for some reason my approach does not seem to work. I am trying to use the following script but it does nothing. I am new to programming so any suggestions are appreciated. These are the folder names that i have.
test.custom.tmp untitledfolder.custom.tmp wis.custom.tmp
I need them renamed to
test untitledfolder wis
I am using the following script but it does nothing.
while read line; do
newname=$(echo "$line" | cut -f 1 -d '_')
mv $line newname;
done < read
Here i created a file called read with all the foldernames that need renaming.
What is wrong with this script and also is there a better way to get this done? Thanks.