name : stop using dots in names.
This commit is contained in:
parent
1e3afbdebc
commit
937fb11d99
|
@ -18,7 +18,16 @@ name()
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# parse new name.
|
# parse new name.
|
||||||
local new_name=$(parse_simplify "${target}")
|
local ext=""
|
||||||
|
local name="${target}"
|
||||||
|
|
||||||
|
# ext only for files.
|
||||||
|
if [[ -f "${target}" ]]; then
|
||||||
|
ext=".${target##*.}"
|
||||||
|
name="${target%.*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local new_name=$(parse_simplify "${name}")${ext}
|
||||||
|
|
||||||
# status line.
|
# status line.
|
||||||
local status="[${count}/${total}] ${target} -> ${new_name}"
|
local status="[${count}/${total}] ${target} -> ${new_name}"
|
||||||
|
|
|
@ -4,9 +4,9 @@ parse_simplify()
|
||||||
{
|
{
|
||||||
echo "${*}" | \
|
echo "${*}" | \
|
||||||
sed -e "s/ /_/g" \
|
sed -e "s/ /_/g" \
|
||||||
-e "s/[^[:alnum:]\._-]//g" \
|
-e "s/[^[:alnum:]_-]//g" \
|
||||||
-e "s/_\+/_/g" -e "s/\.\+/\./g" -e "s/-\+/-/g" \
|
-e "s/_\+/_/g" -e "s/-\+/-/g" \
|
||||||
-e "s/_-/_/g" -e "s/-_/_/g" -e "s/\.-/\./g" -e "s/-\./\./g" -e "s/\._/\./g" -e "s/_\./\./g" \
|
-e "s/_-/_/g" -e "s/-_/_/g" \
|
||||||
-e "s/_\+/_/g" \
|
-e "s/_\+/_/g" \
|
||||||
-e "s/^_//" -e "s/_$//"
|
-e "s/^_//" -e "s/_$//"
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue