The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,777 other followers

Linux shell / ESXi – scripts to get md5sum for sets of files in sorted and regular order

Posted by jpluimers on 2019/05/08

A few small scripts without any parameter checking are below.

The are based on these links:

find-in-datastores.sh

#!/bin/sh 
# Notes:
# the "find" parameter "-type l" only links, as they are the datastore aliases
# the "sed" appends a slash to all datastore paths
datastores_slashes=`find /vmfs/volumes/* -prune -type l | sed 's/$/\//' | xargs echo`
# find inside the datatastores with the arguments appended:
find $datastores_slashes $@

md5sum-sorted-and-regular.sh:

#!/bin/sh 
md5sums=`md5sum $@`
echo Regular:
echo "$md5sums"
echo Sorted:
echo "$md5sums" | sort

md5sum-of-find-in-datastores-by-name-sorted-and-regular.sh :

#!/bin/sh 
md5sum-sorted-and-regular.sh `find-in-datastores.sh -name $@`

Example usage:

# md5sum-of-find-in-datastores-by-name-sorted-and-regular.sh EN-10ENT-x64.vmx
Regular:
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung512NVME/PSO.Template/VM/EN-10ENT-x64/EN-10ENT-x64.vmx
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung850-2TB-S2KMNCAGB04321L/PSO.Inactive/VM/EN-10ENT-x64/EN-10ENT-x64.vmx
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung850-2TB-S3D4NX0HA01043L/PSO.Inactive/VM/EN-10ENT-x64/EN-10ENT-x64.vmx
Sorted:
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung512NVME/PSO.Template/VM/EN-10ENT-x64/EN-10ENT-x64.vmx
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung850-2TB-S2KMNCAGB04321L/PSO.Inactive/VM/EN-10ENT-x64/EN-10ENT-x64.vmx
7f34fbceed59957a4b7feb13ef9327a1  /vmfs/volumes/Samsung850-2TB-S3D4NX0HA01043L/PSO.Inactive/VM/EN-10ENT-x64/EN-10ENT-x64.vmx

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: