in reply to Re: help on stripping out extra extensions
in thread help on stripping out extra extensions
# perl rename rename 's/(?:\.html){2,}$/.html/' *.html
Your oneliner can be shortened by not checking if a substitution will be successful first; the substitution simply fails if no match is found. Untested:# unix rename rename .html.html .html *.html
# perl oneliner perl -e '-f && ($a = $_) =~ s/(?:\.html){2,}$/.html/ && -e $new ? warn + $_ : rename $_, $new for @ARGV' *.html
Makeshifts last the longest.
|
|---|