Delete Files Based on MD5 Hash? - md5

I have a bunch of files. I calculated their MD5 hashes and put those in a text file and called it database.txt
I would like to delete all instances of those files (not just duplicates) based on their MD5 hashes from the text file.
Can anyone help out with some batch code or software suggestions?
The closest thing I've found is https://stackoverflow.com/a/53861527/11980858 but it only deletes duplicates.

Related

cbis-ddsm files names don't match the names in the train/test csv files

I've downloaded the CBIS-DDSM data from the cancer imaging archive and its descriptive train/test csv files. However, I noticed that the names of the dcm files do not match the ones found in the csv files.
For example, a file named Mass-Training_P_00001_LEFT_CC/../1-1.dcm is found as Training_P_00001_LEFT_CC/../000000.dcm in the descriptive csv.
For those who have used this dataset before, how did you handle this?
Thank you for your help.

How to merge two folders full of text files with matching names?

Say I have the following:
C:/folder1/textfile1.txt
C:/folder1/textfile2.txt
C:/folder1/textfile3.txt
C:/folder2/textfile1.txt
C:/folder2/textfile2.txt
C:/folder2/textfile3.txt
I'd like to merge each file in folder2 with its matching file in folder1. If this is possible, how would I go about doing that? I've found a lot of stuff about merging a bunch of text files in a given folder into a single file, but nothing like this.
Thanks.

Using a batch file to copy multiple files with the same name, and past into new folder with differing names

I have a long list of files that are auto-produced every month. they'll all have the same file name, with a sequential file extension like this:file.001, file.002, file.003
Each file has differing information, despite having the same name. What I need to do is copy them from their home directory and paste them into a new directory with names that reflect their purpose, and as text files, like this: Budget.txt, Expense.txt, Retention.txt
Is it possible to do this with a batch file? I've been unable to find a method that works. Any help would be appreciated.
EDIT: I've tried that solution, and it works as far as it goes. the frustrating thing is that the extensions are not always the same, but always sequentially numbered.

How do I copy a single PDF file and batch paste it into hundreds of files with a specific naming convention based on a source .csv or Excel file?

I'm trying to copy a single PDF document into several hundred PDF documents, but they have to have a specific naming convention based on specific user data stored in a .csv (or text, or Excel, any of these sources is fine). I imagine I could use PowerShell for this, but don't know how to approach.
Example:
Take a single PDF - sample.pdf - and rename into 00003021_20160204.pdf where the '00003021_20160204' is one specific user record in the source .csv. I would then copy sample.pdf and repeat the above process several hundred times until my source list was complete.
Note, these are sequential numbers, so I have to rely on the source data.
I tried search stack and google, but found nothing. Though I'm open to suggestions on how I (or others) might better search for this solution in the future.
Thanks!
for /F %%p in (files.txt) do copy %1 "%%p.pdf"
where files.txt has a number on each line and the first parameter is the pdf you want to copy.

Change a files md5 number using a batch file

I'm a really newbie, so sorry if the title isn't grammatically correct :p Anyway...
Can I change a files md5 number using a batch file
It's not clear at all which are your intents but a MD5 is associated with a set of bytes. You cannot change it without changing the bytes and recalculating it. This operation is one-way in the sense that you have your data, you use it to calc the MD5, you keep MD5 around with your file so that you can check the integrity whenever you need it.
This apporach requires the MD5 to be correct a not to be modified..
An MD5 checksum is calculated from the contents of the file. The only way you could change this using a batch file, would be to write a batch file which would modify the file.
If the file is text, you could simply echo some new contents to the end:
echo something >> $filename
If, however, the file is binary, this will lead to corruption.
If your question actually referred to the creation of MD5 checksums, you can obtain FCIV from Microsoft and use this within your batch: http://support.microsoft.com/kb/841290

Resources