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

Install VMware workstation 11 on Fedora 21 with kernel 3.17

How to allow non root user to execute hping command ?