Suggestion: A Nautilus script to check md5 sums?

Asked by Willi

I think a Nautilus script to check md5 sums would be a nice addition, as this is especially useful for checking downloaded Ubuntu images.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Tweak Edit question
Assignee:
No assignee Edit question
Solved by:
Willi
Solved:
Last query:
Last reply:
Revision history for this message
Hertatijanto Hartono (dvertx) said :
#1

Assuming you have zenity installed, you can make the following script:

#!/bin/bash
md5sum -b $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS > /tmp/md5sum
zenity --text-info --title=md5sum \
   --filename=/tmp/md5sum --width=300 --height=20
rm /tmp/md5sum
exit 0

Name the script as md5sum and place it under ~/.gnome2/nautilus-scripts
Don't forget to give executable permission to the script.

Revision history for this message
Hertatijanto Hartono (dvertx) said :
#2

Sorry, I forgot to mention one major weakness of the script above: that the script will give empty result if run against file names which consists of several words (separated by space).

Revision history for this message
Hertatijanto Hartono (dvertx) said :
#3

Below is a better script, with no limitation on filename form:

#!/bin/bash
ORIGINAL_IFS=$IFS
IFS=$'\n'
md5sum -b $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS > /tmp/md5sum.tmp
IFS=' '
read var1 var2 < /tmp/md5sum.tmp
zenity --info --title md5sum --text "\n$var1"
rm /tmp/md5sum.tmp
IFS=$ORIGINAL_IFS
exit 0

As before:
1. name the script as "md5sum" (without quotes)
2. place it under ~/.gnome2/nautilus-scripts
3. do chmod 755 on the script to make it executable
4. the script's name will appear when you right click on a filename in nautilus

Cheers

Revision history for this message
Fastjack (skillful) said :
#4

Hertatijanto,

It's works quite well. Much appreciated,

thanks!

Revision history for this message
Ding Zhou (tualatrix) said :
#5

It seems OK, I will add this script to the Ubuntu Tweak 0.4.9.

Revision history for this message
Willi (strangeq) said :
#6

I've been using these two scripts for a while now:
http://g-scripts.sourceforge.net/cat-fileproc.php#Handle_md5

They do a great job!

Revision history for this message
Ding Zhou (tualatrix) said :
#7

OK, I will update to use this md5 check.