perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
which says:
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^^^^^
for every file in this directory whose extension is '.html',
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^^^^
create a backup copy (with the extension '.bak'), then write the output of
this command back into the original file. the official term for this is
"in-place editing", hence the 'i'.
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^
loop through the file one line at a time, printing the results of the
command (technically, the contents of the "$_" internal variable) before
going on to the next line.
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^
decide what to print (and thus write back into the file) by executing the
string which follows. and that string says:
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^
perform a substitution
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^
for every occurrence of a matching string (not just the first, as is the
default), which makes this a 'global' search & replace function.
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^
ignore case when looking for items that match the target pattern.
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^^^^^
the pattern we're looking for starts with the string 'href="'
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^
followed by any number of characters, of any kind,
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^
up to the next '"' mark.
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^ ^
when you find a string of that type, remember it (store it in a temporary
variable named "$1")
perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
^^^^
and replace it with a copy of itself, converted entirely to lowercase.
after running that, all your URLs should be converted to lowercase in the
original files, but the backups contain original versions of each file.
if something goes wrong, you can back up and start again. if the command
did what you wanted, you can delete all the backup files and be done with
it.