Home > Enterprise >  Get checksum of directory, whilst excluding a particular child directory in Bash
Get checksum of directory, whilst excluding a particular child directory in Bash

Time:12-10

Suppose one has a folder structure:

some_dir/a.txt
some_dir/b.txt
some_dir/c/d.txt
some_dir/.e/f.txt
some_dir/.e/g.txt

How could one get the checksum (e.g. md5sum, or sha256), of:

some_dir/a.txt
some_dir/b.txt
some_dir/c/d.txt

Whilst excluding all contents in some_dir/.e/ in the computation of the checksum?

CodePudding user response:

This might be what you are looking for:

find some_dir -type f \! -path '*/.*' -exec md5sum {}  
  • Related