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

Fedora 19 with kernel 3.10 fail to install vmplayer module.

Setup mail server with ldap authentication in docker

How to allow non root user to execute hping command ?