Artificial intelligent assistant

Recursively apply a command to modify all files in a directory I have a command that reads a file, and outputs a modified version on `stdout`: ./convert /path/to/file How can I recursively apply this command to all files in a directory, and **overwrite the existing contents of each file with the result from the command above**? I found this question which is very similar, but all solutions offered involve outputting the results to a single file, which is not what I want.

If I understand correctly, you can convert one file with


./convert /path/to/file >/path/to/file.new
mv /path/to/file.new /path/to/file


To apply a command to every file in a directory tree, use the `find` utility. Since you need to execute a complex command for each file, you need to invoke a shell explicitly.


find /path/to/top/directory -type f -exec sh -c '
/path/to/convert "$0" >"$0.new" &&
mv "$0.new" "$0"
' {} \;

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 9ac6c2a95dda3ebb84b21e7729e421aa