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

Setup mail server with ldap authentication in docker

Fedora 19 with kernel 3.10 fail to install vmplayer module.

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