Mass Rename Files In Linux Using Bash
Page 1 of 1
Mass Rename Files In Linux Using Bash
edit your .bashrc file
- Code:
sudo gedit .bashrc
- Code:
function rn() {
pathto="$(pwd)"
varin=$1
varout=$2
#
chrinlen=${#varin}
chroutlen=${#varout}
#
#
clear
echo "Changing Filetype (Mass Renamer) By J~Net 2019"
echo ""
echo "Char Length For Input $varin $chrinlen"
echo "Char Length For Input $varout $chroutlen"
echo ""
#
echo "Starting..."
for file in *.$varin ; do
#
mv $file $(echo $file | rev | cut -c5- | rev).$varout # this is for going from 3 char filetype to a 3
# mv $file $(echo $file | rev | cut -c6- | rev).$varout # this is for going from 2 char filetype to a 3
done
echo "Finished!"
echo ""
ls
}
- Code:
Example usage:
rn md txt
Last edited by jamied_uk on 17th November 2019, 10:06; edited 3 times in total
Re: Mass Rename Files In Linux Using Bash
You may need to some how detect the filetype char length and use case to make sure no twp dots end up in filename etc! good luck with that!
Similar topics
» Linux Bash Mass Scanning The Whole Internet & Web Cams
» FTP Files From Linux With Bash
» Linux Bash Replace Strings in PHP Files
» Converting Doc & Docx To PDF Files On Linux With Bash
» Sending & Receiving Binary Files Via Bash On Linux
» FTP Files From Linux With Bash
» Linux Bash Replace Strings in PHP Files
» Converting Doc & Docx To PDF Files On Linux With Bash
» Sending & Receiving Binary Files Via Bash On Linux
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum