ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: HashReplace - Replace all files with identical contents

(1/1)

justice:
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 ---replace some_file.php c:\projects\example_projectHowever 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

mouser:
very nice idea!

justice:
If you want to play with the latest source, you can now fork from Bitbucket:
https://bitbucket.org/svandragt/hashreplace

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

david842:
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.

Navigation

[0] Message Index

Go to full version