Skip to content

Instantly share code, notes, and snippets.

@navitronic
Created May 11, 2020 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navitronic/e6e4e1707c66d24a786d5f1832d32232 to your computer and use it in GitHub Desktop.
Save navitronic/e6e4e1707c66d24a786d5f1832d32232 to your computer and use it in GitHub Desktop.

Step 1.

Download parrott.sh and put it somewhere on your computer. eg Desktop.

Step 2.

In terminal, run:

sh parrott.sh folderA folderB

It should output all the files in folderA that are missing from folderB.

You should be able to run it on whole volumes (aka disks)

sh parrott.sh /Volumes/USB1 /Volumes/USB2
#!/bin/bash
set -eo pipefail
IFS=$'\n'
SRC=$1
DEST=$2
for SRC_FILE in $(find $SRC -type f -name \*.* -print)
do
FOUND=0
for MATCHING_FILE in $(find "$DEST" -type f -name "$(basename "$SRC_FILE")" -print)
do
cmp --silent "$SRC_FILE" "$MATCHING_FILE" && FOUND=1 && break
done
# if FOUND=0 then echo
if [ "$FOUND" -eq "0" ]; then
echo "$SRC_FILE";
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment