Finding files based on different names I know how to do. The problem is that I don't know how delete all of them at once. I am using OMVS in z/OS390.
To find files searching by different extensions I am successfully doing:
find . -name "*.xml" -o -name "*.ipm" -type f
To delete files after searched by only one name, I am successfully doing:
find . -name "*.xml" -type f -exec rm -iv {} \;
Well, if I mixed both ideas, I get deleted only files found by the last -name:
find . -name "*.xml" -o -name "*.ipm" -type f -exec rm -iv {} \;
In this case, it seems the files matched the first pattern (*.xml
) aren't affected by -exec rm
.
After searching around, I guessed that the problem is that I have to "hold" all names found before executing the rm
. I tried three approaches without success...
First attempt:
$ find . -name "*.xml" - o -name "*.ipm" -type f -print0 | xargs -0
FSUM6372 Unknown option "-"
Usage: find directory ... expression
xargs: FSUM6001 Unknown option "-0"
Usage: xargs Ý-l#¨Ý-L #¨ Ý-irepl¨Ý-I repl¨ Ý-n#¨ Ý-tpx¨ Ý-s#¨ Ý-eeof¨Ý-E eof¨ Ýc
md Ýargs ...¨¨
Second attempt:
$ find . (-name "*.xml" - o -name "*.ipm") -type f
FSUM7332 syntax error: got (, expecting Newline
Third attempt:
$ find . -type f \(-name "*.xml" -o -name "*.ipm"\)
FSUM6372 Unknown option "(-name"
Usage: find directory ... expression