Skip to content

Instantly share code, notes, and snippets.

@dereksz
dereksz / TreeReorg.sh
Last active Aug 29, 2015
Reorganizing files in directory tree
View TreeReorg.sh
# Create relative sha1 deep files
sha1deep -rel . | tee sha1deep.log
# Create missing dirs referenced in a SHA1sum file
sed -re 's/^[0-9a-f]+\s+//;s!/[^/]*$!!' SD.log | sort -u | xargs -I{} mkdir -p "{}"
# Take two md5deep checksum files and re-arrange one directory based on the other
join -j1 <(sed -re 's/ +/ "/;s/$/"/' 1.4Tb.log | sort) <(sed -re 's/ +/ "/;s/$/"/' SD.log | sort) |
sed -re 's/^[0-9a-f]+/mv -v /' |
bash
@dereksz
dereksz / git-one-liners.sh
Created Nov 30, 2014
useful git one-liners
View git-one-liners.sh
# Find UNICODE files
find -name '*.tt' | xargs -I{} file {} | grep -F 'UTF-16'
# Modified files - check types
git status -s | sed -nre 's/^ M //p' |
xargs -I{} file {} # and check the files 'type' (looking for unicode madness here!)cd ..