find . -name "filename including space" -print0 | xargs -0 ls -aldF > log.txt
find . -name "filename including space" -print0 | xargs -0 rm -rdf
Is it possible to combine these two commands into one so that only 1 find will be done instead of 2?
I know for xargs -I there may be ways to do it, which may lead to errors when proceeding filenames including spaces. Any guidance is much appreciated.
If you’re just wanting to avoid doing the
findmultiple times, you could do ateeright after thefind, saving thefindoutput to a file, then executing the lines as:Another way to accomplish this same thing (if indeed it’s what you’re wanting to accomplish), is to store the output of the
findin a variable (supposing it’s not TB of data):