I would like
find
to execute a different command depending on what the stat
s of a file are.
If I run the command
find . -name "*" -exec echo {} \+
then I get the list of files in the directory. As expected, adding echo `` gives the same result:
find . -name "*" -exec echo echo {}
\+
On the other hand, with stat
the situation is different.
find . -name "*" -exec stat {} \+
works as expected. However,
find . -name "*" -exec echo stat {}
\+
returns the error
stat: {}: stat: No such file or directory
In this case, the braces {}
do not get expanded like they do in the echo
example. How do I make the expansion work as expected?
Asked by Alex
(1220 rep)
Oct 25, 2023, 12:21 AM
Last activity: Oct 25, 2023, 12:41 AM
Last activity: Oct 25, 2023, 12:41 AM