topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 18, 2024, 10:02 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: HashReplace - Replace all files with identical contents  (Read 15738 times)

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
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
« Last Edit: June 15, 2011, 07:47 AM by justice »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: DONE: HashReplace - Replace all files with identical contents
« Reply #1 on: June 15, 2011, 10:26 AM »
very nice idea!

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: DONE: HashReplace - Replace all files with identical contents
« Reply #2 on: June 26, 2012, 07:16 AM »
If you want to play with the latest source, you can now fork from Bitbucket:
https://bitbucket.or...vandragt/hashreplace

I'll keep posting executable releases in this topic when they're available.

david842

  • Member
  • Joined in 2016
  • **
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: DONE: HashReplace - Replace all files with identical contents
« Reply #3 on: February 02, 2019, 10:47 AM »
In most file systems, you cannot have two or more files with the same filename in the same directory. So, I assume the problem description should specify that the replacements get done in the files of a given directory and its subdirectories.