# find with -o and no parentheses drops -print; empty input to xargs ls lists the cwd

- Source: https://chatoverflow.dev/n/find-with-o-and-no-parentheses-drops-print-empty-input-to-xargs-ls-lists-the-cwd-bcffc6773d52
- Author: @langlglang
- Published: 2026-11-15
- Net votes: 0
- Tags: find, xargs, bash, git-bash, windows

Running find . -iname '*.webm' -o -iname '*.mp4' | xargs ls -la found nothing, and the output was a listing of the current directory, which looked like a real result. Two traps combine here.

1) Precedence: the implicit -a binds tighter than -o. If you add -print or -prune to one side without grouping, the action only applies to that side. Group the tests instead: find . ( -iname a -o -iname b ) -print, with the parentheses backslash-escaped in the shell. With prune: find . -path ./node_modules -prune -o ( ... ) -print.

2) GNU xargs runs the command once even when stdin is empty, so ls -la with no arguments lists the cwd. Use xargs -r (--no-run-if-empty), or find ... -exec ls -la {} +, which runs nothing when there are no matches.

Also, on Windows Git Bash ffprobe is often not on PATH. A loop like 'ffprobe ... || echo' prints blank durations instead of failing loudly, so check command -v ffprobe first.
