Create Automator Service to make MD5 Checksum of External Hard Drive

Joined
May 26, 2012
Messages
2
Reaction score
0
Points
1
Hello,

Can someone help me make an Automator Service that will generate an MD5 Checksum of a Hard Drive just by Right Clicking the Drive and selecting the service? I'm new to this!

Thanks!
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
I have'nt done much with Automator myself, but I do believe you can run Applescripts in Automator workflows, and there is a Unix command line utility called "md5" that returns a checksum on any files or folders supplied to it, if you open up the Terminal app and type this into the command line followed by the return key.

Code:
md5 (yourFileName.txt)

this will return the checksum for the file if it is a valid file path, for more info on the md5 command, type this into the terminal.

Code:
man md5

this will return the manual for the md5 utility, I dont know if the same utility can be used for drive paths as well, or if there is another command line tool for your purposes, you may have to check that with one of the Unix tools websites.

If you do know any Applescript coding, then you can design a Applescript droplet that runs a shell script command to the md5 utility, when a file or folder or drive is dropped onto your droplet application, for example.

Code:
on run
	set filePath to POSIX path of (path to documents folder) & "MyTextFile.txt" as text
	set theResult to do shell script "md5" & space & quoted form of filePath
	return theResult
end run

This will return the checksum result on a file called MyTextFile.txt in your Documents folder.
If you put this code into a on open handler instead of an on run handler, then it will return the same result when files are dropped onto your compiled droplet application.

Like Automator, I dont know a lot of Applescript, but I always go to the MacScripter forums for help with my scripts, there are some really smart and knowledgable guys over there, that could probably come up a a trick Applescript solution for you.

MacScripter

Sorry I could not be more help.

Regards Mark
 
OP
E
Joined
May 26, 2012
Messages
2
Reaction score
0
Points
1
What I have created right now is an Automator Service. The Service is selected for Files and Folders with the Application Finder. I then have a Shell Script with the following code:

find $1 $2 $3 $4 $5 -type f -exec md5 -r "{}" \; > $1/../DRIVE.md5

What this allows me to do is select multiple folders at a time, right click and select my service and then it creates an MD5 file on the Parent Directory. Unfortunately, I would like to be able to right click on a hard drive, select the service and it generate an MD5 file of the entire hard drive, with the MD5 file saving on the hard drive.

I have been able to use the code via Terminal by using "cd" and selecting the drive path and then pasting in the code, but I would like to skip the whole process of doing this via Terminal. Maybe the Automator Service is in correct and there can be a better way to do this? I've really new to scripting and have had help from others creating this code but no success yet at doing what I would want it to be doing.

Suggestions? Thanks for the help!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top