|
From: Robert D. <rob...@gm...> - 2024-03-02 06:28:03
|
On Fri, Mar 1, 2024 at 8:33 PM El Observatorio De Matemática
<obs...@gm...> wrote:
> find "$subdir" -type d ! \( -name 'Common-Lisp' -o -name 'Maxima' \) -exec rm -r {} +
I don't understand exactly what you need to do, but my advice about
problems of this kind is to first use the script to identify the files
that are targeted, and just print out their names. Then review the
list of names and then do a simpler loop over the list to actually
delete them. Something like
$ find "$subdir" -type d ... other criteria go here ... -print
and then, when the list looks right, capture it in a shell variable
via backticks; note that !! is the immediately preceding command,
executed again.
$ a=`!!`
and then actually remove the items in the list:
$ rm $a
Same basic idea applies to Maxima or Python or whatever -- review the
list before making an irreversible change.
Hope this helps,
Robert
|