#!/bin/sh if [ $# -eq 0 ] then echo "Usage: $0 DIR..." fi tmp_file_0="$(mktemp)" > "$tmp_file_0" for dir in "$@" do find "$dir" -type f -exec sh -c "printf '%s\t%s\n' \"$(basename {})\" \"{}\" >> \"$tmp_file_0\"" ';' done # cut -f1 < "$tmp_file_0" for file in $(cut -f1 < "$tmp_file_0" | uniq -u) do echo "$file" done # uniq -u < "$tmp_file_0" | xargs -d '\\n' ftag file add rm "$tmp_file_0"