Skip to content

Instantly share code, notes, and snippets.

@navitronic
Created May 11, 2020
Embed
What would you like to do?

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