17 lines
328 B
Bash
Executable File
17 lines
328 B
Bash
Executable File
#!/bin/bash
|
|
|
|
IFS=$'\n'
|
|
if [ -z "$1" ]
|
|
then echo rename files in current folder replacing arg1 with arg2.
|
|
exit
|
|
fi
|
|
|
|
for file in $( ls | grep "$1" )
|
|
do echo "$file" '->' "$( echo $file | sed s/"$1"/"$2"/g )"
|
|
done
|
|
echo 'sure?'
|
|
read i
|
|
for file in $( ls | grep "$1" )
|
|
do mv -iv "$file" "$( echo $file | sed s/"$1"/"$2"/g )"
|
|
done
|