I'm wanting to find multiple files as in
find /etc/ /usr/ -type f,d -size +1k -exec ls -slah {} /; -exec rm -riv {} +
My question to you is how can I delete only the file size 5k and below with the -exec option
I'm wanting to find multiple files as in
find /etc/ /usr/ -type f,d -size +1k -exec ls -slah {} /; -exec rm -riv {} +
My question to you is how can I delete only the file size 5k and below with the -exec option
If I understand your question correctly, you want to:
/etc
and /usr
In that case, what you want is this:
find /etc /usr -type f -size -5k -delete
Notice that there is no need for -exec, since you can simply use the -delete option.
In your question you wrote -size +1k
. Did you mean to ask about finding files which are between 1k and 5k in size? If that was the case, then you can simply specify the -size
option twice:
find /etc /usr -type f -size +1k -size -5k -delete