Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created October 16, 2022 11:33
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 justdoit0823/1a5ab62cecbf37634ad2f2a35ba5794a to your computer and use it in GitHub Desktop.
Save justdoit0823/1a5ab62cecbf37634ad2f2a35ba5794a to your computer and use it in GitHub Desktop.
#!/bin/bash
RES=$(find ~/Documents/collections|awk -F'@@@' '{a=a"@@@"$1;} END {print a;}')
echo $RES
IFS='@@@' read -ra DATA <<< "$RES"
for f in "${DATA[@]}"
do
filename="${f#/Users/justdoit/Documents/collections/}"
# echo "$filename"
# echo "$f"
if [[ -e ~/Downloads/"$filename" ]]; then
continue
else
echo "$filename"
fi
done
function diff(){
SRCDIR="$1"
DSTDIR="$2"
RES=$(find $SRCDIR|awk -F'@@@' '{a=a"@@@"$1;} END {print a;}')
echo $RES
IFS='@@@' read -ra DATA <<< "$RES"
for f in "${DATA[@]}"
do
filename="${f#$SRCDIR}"
if [[ -e "$DSTDIR$filename" ]]; then
continue
else
echo "$filename"
fi
done
}
function main(){
SRC=$1
DST=$2
diff $SRC $DST
}
main $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment