Free Republic
Browse · Search
Bloggers & Personal
Topics · Post Article

Skip to comments.

How can I change all characters in link addresses (or only btwnhttp:// and .html) <b>within<b> all files in selected folder(s) into lower case? Maybe a batch file or regex string. I have utilities in Windows such utilities Multi Commander, GrepWin, etc.
Freerepublic.com ^ | Thu, 12/02/21 | daniel1212

Posted on 12/02/2021 3:36:29 PM PST by daniel1212

The basic need is not that of changing all file names (multi commander has that in the menu) but that of changing the case of all the characters within a text that begin with http and end with html.

The situational context (take deep breath) is of html files which used to work on a Windows server, but being now on a Linux server which are case sensitive - and with a unresolvable glitch (read on), then it seems that unless one can edit a server's httpd.conf then clicking on a link that begins with a upper case letter can result in a 404 (as here - tell me if you get a 404 as I do), even though the file is present, and instead requires lower case, as http://peacebyjesus.net/proclamationnationalfastday.html.

However, due to these working in past, having come from a now retired hosting service using a Windows server (which does not have the case sensitive issue) and which were created years ago, and seeing as I had no problem with them working, then now there are loads of links to pages of mine within my files (as well as on the Internet) which use upper case names).

And so even though I have changed most all my file names to lower case yet amid about 400 web pages there are many in them with upper case letters which I want to change, but not one by one. As for the links of mine to pages on the Internet which use upper case names, I am looking at moving to a different hosting company, maybe with a Windows server.

Note that some links that begin with upper case names do work, as this http://www.peacebyjesus.net/Bible/Luke_1.html, while others will not, as this, http://www.peacebyjesus.net/Bible/John_1.html, even though the file name is as it appears (John_1.html), with an upper case J. and in the same folder as Luke.

But this situation became much worse after I tried a htaccess redirect to https, having obtained a SSL certificate (some browsers complain), which did not work, and I deleted the edit (and even all else once) to no avail, and the hosting company cannot help more.

So all that situational context aside, I just want a way to change all the characters within a text that begin with http and end with html.


TOPICS: Computers/Internet; Hobbies; Miscellaneous
KEYWORDS: coding; epicfail; linuxwindows; programming; vanity
Navigation: use the links below to view more comments.
first 1-2021-4041-57 next last
Thanks for any helpful input. Grace and peace thru Jesus the Lord.
1 posted on 12/02/2021 3:36:29 PM PST by daniel1212
[ Post Reply | Private Reply | View Replies]

To: daniel1212

“...tell me if you get a 404 as I do...”
-
I did not get a 404.


2 posted on 12/02/2021 3:43:58 PM PST by Repeal The 17th (Get out of the matrix and get a real life.)
[ Post Reply | Private Reply | To 1 | View Replies]

To: ShadowAce; dayglored

Ping


3 posted on 12/02/2021 3:44:04 PM PST by daniel1212 ( Turn to the Lord Jesus as a damned+destitute sinner, trust Him to save + be baptized + follow Him!)
[ Post Reply | Private Reply | To 1 | View Replies]

To: daniel1212

Program called Notepad++ could be of service to you. Search the web for Notepad++ download and thank the creator Don Ho.


4 posted on 12/02/2021 3:44:23 PM PST by sjm_888
[ Post Reply | Private Reply | To 1 | View Replies]

To: daniel1212

Build a dictionary list of all files. Then process each file and parse word tokens. If the token matches (case insensitive) a file name, then convert the case on that token.


5 posted on 12/02/2021 3:44:49 PM PST by BiglyCommentary
[ Post Reply | Private Reply | To 1 | View Replies]

To: daniel1212

Sounds like a sed and awk project. Unfortunately, I’m rusty. An experience Unix guy would just write the command in a flash.


6 posted on 12/02/2021 3:45:11 PM PST by proxy_user
[ Post Reply | Private Reply | To 1 | View Replies]

To: daniel1212

sed is great at replacing characters like that.


7 posted on 12/02/2021 3:45:29 PM PST by ShadowAce (Linux - The Ultimate Windows Service Pack )
[ Post Reply | Private Reply | To 1 | View Replies]

To: proxy_user

30 years ago I could whip up a lex and yacc parser for this in short order. Today... whats that...


8 posted on 12/02/2021 3:47:39 PM PST by BiglyCommentary
[ Post Reply | Private Reply | To 6 | View Replies]

To: Repeal The 17th
"I did not get a 404."

You mean you actually get the web page http://peacebyjesus.net/ProclamationNationalFastDay.html ?

I receive:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

peacebyjesus.net
Apache

9 posted on 12/02/2021 3:47:47 PM PST by daniel1212 ( Turn to the Lord Jesus as a damned+destitute sinner, trust Him to save + be baptized + follow Him!)
[ Post Reply | Private Reply | To 2 | View Replies]

To: daniel1212

There are some http server plugins that can automatically correct for incorrect case.
So you could request http://foo.com/ABC.html
So you could request http://foo.com/abc.html
and the file ABC, abc, or even Abc.html will get served.

That said, grep would do the trick.

But since html and http are (usually/conventionally) lower case, you could just go through the files and convert them all to lower case.

Always work on a copy.. easy to make a mistake or not catch an edge case that breaks everything.

If you get stuck, you can always request some help on fiverr or upwork (a job like that might be $15.)


10 posted on 12/02/2021 3:48:50 PM PST by bhl
[ Post Reply | Private Reply | To 1 | View Replies]

To: bhl
Oh, just saw you're using Apache. Try enabling the spell check module: CheckSpelling On CheckCaseOnly On
11 posted on 12/02/2021 3:50:23 PM PST by bhl
[ Post Reply | Private Reply | To 10 | View Replies]

To: sjm_888
"Program called Notepad++ could be of service to you. Search the web for Notepad++ download and thank the creator Don Ho."

Thanks, I have that, as well as Multi Commander (very robust), GrepWin, but cannot find the option or figure out the regex coding needed to do this case replacement within a sentence. That is why I posted this.

12 posted on 12/02/2021 3:51:23 PM PST by daniel1212 ( Turn to the Lord Jesus as a damned+destitute sinner, trust Him to save + be baptized + follow Him!)
[ Post Reply | Private Reply | To 4 | View Replies]

To: daniel1212

Yes, here it is, plain as day:
-
Proclamation for National Day of Humiliation, Fasting, and Prayer

President Abraham Lincoln

WHEREAS, The Senate of the United States; devoutly recognizing the Supreme authority and just government of Almighty God in all the affairs of men and nations, has, by a resolution, requested the President to designate and set apart a day for National prayer and humiliation.

And Whereas, it is the duty of nations, as well as of men, to owe their dependence upon the overruling power of God, to confess their sins and transgressions, in humble sorrow, yet with assured hope that genuine repentance will lead to mercy and pardon, and to recognize the sublime truth announced in the Holy Scriptures and proven by all history, that those nations only are blessed whose God is the Lord.

And, insomuch as we know that, by His Divine law, nations like individuals are subjected to punishments and chastisements in this world, may we not justly fear that the awful calamity of civil war, which now desolates the land, may be but a punishment inflicted upon us for our presumptuous sins, to the needful end of our national reformation as a whole People. We have been the recipients of the choicest bounties of Heaven. We have been preserved, these many years, in peace and prosperity. We have grown in numbers, wealth, and power as no other nation has ever grown.

But we have forgotten God.

We have forgotten the gracious hand which preserved us in peace, and multiplied and enriched and strengthened us; and have vainly imagined, in the deceitfulness of our hearts, that all these blessings were produced by some superior wisdom and virtue of our own. Intoxicated with unbroken success, we have become too self-sufficient to feel the necessity of redeeming and preserving grace, too proud to pray to the God that made us!

It behooves us, then, to humble ourselves before the offended Power, to confess our national sins, and to pray for clemency and forgiveness.

Now, therefore, in compliance with the request, and fully concurring in the views of the Senate, I do, by this my proclamation, designate and set apart Thursday, the 30th day of April, 1863, as a day of national humiliation, fasting, and prayer. And I do hereby request all the People to abstain, on that day, from their ordinary secular pursuits, and to unite, at their several places of public worship and their respective homes, in keeping the day holy to the Lord, and devoted to the humble discharge of the religious duties proper to that solemn occasion.

All this being done, in sincerity and truth, let us then rest humbly in the hope, authorized by the Divine teachings, that the united cry of the Nation will be heard on high, and answered with blessings, no less the pardon of our national sins, and the restoration of our now divided and suffering Country, to its former happy condition of unity and peace.

In witness whereof, I have hereunto set my hand, and caused the Seal of the United States to be affixed.

Done at the City of Washington, this thirtieth day of March, in the year of our Lord one thousand eight hundred and sixty-three, and of the Independence of the United States the eighty seventh.

Abraham Lincoln, President

William H Seward,

Secretary of State

The Senate resolution requesting the president to proclaim a day for “national prayer and humiliation” was introduced by Senator James Harlan on March 2, and adopted on March 3, 1863.


www.peacebyjesus.net

Email: saved2serve@gmail.com

Bless the LORD, O my soul: and all that is within me, bless HIS holy name. Bless the LORD, O my soul, and forget not all HIS benefits (Ps. 103:1, 2).


13 posted on 12/02/2021 3:52:28 PM PST by Repeal The 17th (Get out of the matrix and get a real life.)
[ Post Reply | Private Reply | To 9 | View Replies]

To: BiglyCommentary
"Build a dictionary list of all files. Then process each file and parse word tokens. If the token matches (case insensitive) a file name, then convert the case on that token."

I can find all the links, but changing hundreds takes a lot of time.

14 posted on 12/02/2021 3:53:19 PM PST by daniel1212 ( Turn to the Lord Jesus as a damned+destitute sinner, trust Him to save + be baptized + follow Him!)
[ Post Reply | Private Reply | To 5 | View Replies]

To: daniel1212

Whatever problem you are experiencing
is not because of upper case in the file names.


15 posted on 12/02/2021 3:55:33 PM PST by Repeal The 17th (Get out of the matrix and get a real life.)
[ Post Reply | Private Reply | To 13 | View Replies]

To: daniel1212
Windows Powershell (built into Windows 7 and newer) can handle this.

https://stackoverflow.com/questions/3822745/rename-files-to-lowercase-in-powershell

Use -Recurse if you want to change filenames in subfolders too.
"gci" is the PowerShell abbreviation for Get-ChildItem

gci -Recurse |
? { $_.Name -cne $_.Name.ToLower() } |
% { ren $_.Name -NewName $_.Name.Tolower() }

16 posted on 12/02/2021 3:56:43 PM PST by T.B. Yoits
[ Post Reply | Private Reply | To 1 | View Replies]

To: daniel1212

You do that all in a code loop. Should run in under a minute.


17 posted on 12/02/2021 3:56:49 PM PST by BiglyCommentary
[ Post Reply | Private Reply | To 14 | View Replies]

To: ShadowAce
" sed is great at replacing characters like that. "

You mean Stream EDitor (sed) Thanks. Again, the issue is figuring out what coding is needed/will work to find and change the case on just the links in a specific folder and its subfolders. I will keep looking and reading.

18 posted on 12/02/2021 4:01:34 PM PST by daniel1212 ( Turn to the Lord Jesus as a damned+destitute sinner, trust Him to save + be baptized + follow Him!)
[ Post Reply | Private Reply | To 7 | View Replies]

To: T.B. Yoits
You can convert all the text within a file using PowerShell that's built into Windows 7 and newer. This link is for txt files but the command would work on any designated extension.

https://stackoverflow.com/questions/47792596/script-to-convert-all-txt-file-content-to-lowercase

19 posted on 12/02/2021 4:03:10 PM PST by T.B. Yoits
[ Post Reply | Private Reply | To 16 | View Replies]

To: daniel1212

You might take a look at this article:
https://www.datasciencebytes.com/bytes/2014/11/13/using-sed-to-make-specific-text-lowercase-in-place/

I thing it will get you close; you just have to adjust the regular expression in the command string to your requirements.


20 posted on 12/02/2021 4:04:05 PM PST by rightwingcrazy (;-,)
[ Post Reply | Private Reply | To 18 | View Replies]


Navigation: use the links below to view more comments.
first 1-2021-4041-57 next last

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
Bloggers & Personal
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson