2022-12-25
Can be done with find -exec
or find | xargs
with various tradeoffs.
Example, search through all python files and show results with line number and filename.
find -name \*.py -exec grep -Hn "search terms" {} \;
No trailing slash - copy directory
rsync -avz /foo/bar /baz
copies directory bar
to /baz/bar
Trailing slash - copy directory contents
rsync -avz /foo/bar/ /baz
copies contents of /foo/bar
to /baz
without creating bar directory.