Write a script that compares two directories and lists files present in one but not the other.

IntermediateHands-onBash scripting tasks
Answer
diff <(cd dirA && find . -type f | sort) <(cd dirB && find . -type f | sort)
# or only names unique to dirA:
comm -23 <(cd dirA && find . -type f | sort) <(cd dirB && find . -type f | sort)

Key trick → Process substitution <(...) turns command output into a file path, and comm needs both inputs sorted.

All Real-World Interview questions Roadmap: Interview readiness

More on Bash scripting tasks