|
|
See here: Fast Search and Replace in Large Number of Files: A Practical Guide[^]
Hello all,
My name is Dr. Brian Hart, and I am a PhD astrophysicist and one of the original users of The Code Project from back in the year 2000. I've written many articles in C++ and C# programming.
I just wanted to share a link to an article I just posted, today, on The Code Project. I hope you will stop by and take a look.
It's about using memory-mapped files in C# to do a search and replace a large number of files fast. I implemented the algorithm both as a (really bare-bones) console application and a more graphical/user-friendly Windows Forms tool.
It came out of work that I was doing on this .sln file that contains almost 1,000 projects in Visual Studio, and I was pushing my existing Find In Files / Replace In Files tools to the limit. I needed to write my fast algorithm as part of a file- and project-renaming tool I was writing, partly to manage the refactoring of so much code.
The code included with the article compiles (after doing a nuget restore in the Solution directory). It should be informative and a great example of processing a huge number of files really fast.
The impetus of the article was trying to imitate the speed with which Notepad++ processes files with its Find in Files and Replace in Files operations.
I also include code to create a progress dialog in WinForms and report the operation's progress to the user while keeping the GUI responsive. I hope it helps someone with their programming work!
Regards,
Brian Hart
|
|
|
|
|
|
Brian C Hart wrote: I just wanted to share a link to an article I just posted, today
Don't do this.
There is already a feed of recently posted articles[^], and multiple newsletters which list the recently posted articles. Anyone who is interested in the topic will see your article there and read it.
Recent articles are also posted on the CodeProject Twitter feed, for those who still use that site.
Posting in The Lounge to promote your new article stinks of spam / rep-point hunting. Imagine how useless the forum would become if every author did this!
You think it's annoying having a daily Wordle thread? Having page after page of "Check out my new article", "No, check out MY new article", "My new article is better than your new article"" etc. threads would be a thousand times worse.
And it's not going to achieve much. By this time next week, your article promotion post will be buried on page 42, where nobody is ever likely to see it.
So seriously, don't do this.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Spot on!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And yet he gets 4 up-votes. ![WTF | :WTF:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_WTF.gif)
|
|
|
|
|
I'm holding off with the spam vote, but the article points to a youtube channel and states that the author may be offered incentives for pointing people to that channel.
|
|
|
|
|
Good spot! Probably worth flagging that up to @sean-ewington for review.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
This is cool and not cool at the same time.
Jeremy Falcon
|
|
|
|
|
|
this is the most awesome thing ever. C'mon Star Trek and Babylon 5! Science fiction needs to turn into science fact! I have to get off this dumb planet sooo bad... ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Brian C Hart wrote: I have to get off this dumb planet sooo bad...
Graffiti:
Q: Is there intelligent life on Earth?
A: Yes, but I'm just visiting.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
π΅ And pray that there's intelligent life
Somewhere up in space
'Cos there's bugger all
Down here on Earth! π΅
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Wordle 1,055 6/6*
β¬β¬β¬β¬π¨
β¬β¬β¬π¨π¨
π¨π©β¬β¬β¬
β¬π©β¬β¬π¨
β¬π©π©π©π©
π©π©π©π©π©
|
|
|
|
|
Kinda looks like Mario running to left but his hat fell on his face.
Jeremy Falcon
|
|
|
|
|
Wordle 1,055 4/6
β¬π¨β¬β¬π¨
β¬π©π©β¬β¬
β¬π©π©β¬π©
π©π©π©π©π©
|
|
|
|
|
Wordle 1,055 6/6
β¬β¬β¬π¨β¬
β¬π©β¬β¬π¨
β¬π©π©β¬β¬
β¬π©π©β¬β¬
β¬π©π©β¬π©
π©π©π©π©π©
|
|
|
|
|
Wordle 1,055 6/6
β¬β¬β¬β¬π¨
β¬β¬π¨β¬π¨
π¨β¬π¨π¨β¬
π¨π©β¬β¬π¨
β¬π©π©π©π©
π©π©π©π©π©
|
|
|
|
|
Wordle 1,055 5/6
β¬β¬β¬β¬π¨
β¬β¬β¬π¨π¨
β¬π©π©β¬π©
β¬π©π©π©π©
π©π©π©π©π©
Looks like almost everyone went about the same word sequence. Funny ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
modified 2hrs 20mins ago.
|
|
|
|
|
Wordle 1,055 5/6
β¬π©β¬π¨β¬
β¬π©β¬β¬π¨
β¬π©π©β¬β¬
β¬π©π©β¬π©
π©π©π©π©π©
Jeremy Falcon
|
|
|
|
|
Wordle 1,055 6/6*
β¬π¨β¬β¬π¨
β¬β¬β¬π¨π¨
β¬π©β¬π¨β¬
β¬π©π©β¬π©
β¬π©π©π©π©
π©π©π©π©π©
That was close!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
β¬π¨β¬β¬π¨
β¬β¬β¬β¬β¬
β¬π©π©β¬β¬
β¬π©π©β¬π©
π©π©π©π©π©
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 1,055 6/6*
β¬β¬β¬β¬π¨
π¨β¬β¬π¨π©
β¬π©π©β¬π©
β¬π©π©β¬π©
β¬π©π©π©π©
π©π©π©π©π©
Happiness will never come to those who fail to appreciate what they already have. -Anon
And those who were seen dancing were thought to be insane by those who could not hear the music. -Frederick Nietzsche
|
|
|
|
|
Wordle 1,055 4/6
β¬β¬β¬β¬β¬
β¬β¬β¬β¬β¬
β¬🟨🟨🟨β¬
🟩🟩🟩🟩🟩
Ok, I have had my coffee, so you can all come out now!
|
|
|
|