Created
February 6, 2014 02:04
-
-
Save carlosmcevilly/8837171 to your computer and use it in GitHub Desktop.
make hashes of the ls -lR output for each directory and its subdirectories (one level down) in a ~/work/ directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export index=~/work/indexes | |
mkdir -p $index | |
cd ~/work | |
for dir in `ls -d *` | |
do | |
if [[ -d "$dir" ]]; then | |
echo doing $dir | |
ls -lR $dir/ > $index/$dir.ls-lR.txt | |
cd $dir | |
for subdir in `ls -d *` | |
do | |
if [[ -d "$subdir" ]]; then | |
export hashed=`echo $subdir | shasum | cut -f1 -d' '` | |
ls -lR $subdir/ > $index/$dir-$hashed-ls-lR.txt | |
fi | |
done | |
cd ~/work/ | |
fi | |
done | |
cd indexes | |
shasum -a 384 *ls-lR.txt > hashes.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment