bash Script to remove string from filename

This bash script is to remove or replace a string from the filename.

#!/bin/bash

for THISFILE in *
do
filename=${THISFILE%\.*}
extension=${THISFILE##*\.}
newname=${filename//./_}
echo "mv $THISFILE ${newname}.${extension}"
#mv $THISFILE ${newname}.${extension}
done



---

Comments

Popular posts from this blog

Microsoft Azure Backup encountered and internal error. (ID: 130001)

Boot Acronis from PXE

Fedora 19 with kernel 3.10 fail to install vmplayer module.