What are Coding Snacks?

Coding Snacks represent the best of DonationCoder.

On a special section of our forum, anyone can post an idea for a small custom utility/program.

Coders who hang out on our forum keep an eye out for interesting requests and when they see one that catches their interest, they code it and release it to the public for free.

People who find the tools useful are encouraged to donate directly to the coders to show their appreciation.

Forum Links:

  • Browse completed coding snacks: here.
  • Browse and submit new requests: here.
Latest Forum Posts

What are Coding Snacks?

Coding snacks are small custom utilities written by coders who hang out on DonationCoder in response to requests posted on our forum.

You are viewing a specific blog item. Click here to return to the main blog page.

DONE: HashReplace - Replace all files with identical contents

blog clipart
What it does:
Replace all files in a folder with identical filename AND SHA1 hash as original.file with new.file.

Use Cases
Say I have updated the contents of a php file that is used multiple times throughout my project, and now I want all other copies of that file to be updated as well.
In most cases the following code would work:
Code: Text [Select]
  1. replace some_file.php c:\projects\example_project
However if the file is readme.txt or config.php for example, then you'd have overwritten many wrong copies. Using HashReplace only files with the same name and same contents will be overwritten with the new contents.

Download
Source, Executable and Test files



Share on Facebook