I had the task of writing a shell script to find and delete the backed up files from the database. I knew that there was a find command to search for files, but I was looking for a command to search → delete all at once, so I will summarize it.
Many sites have come up with the idea that you should execute the -exec action while googled the command that I was looking for to do everything from search to delete.
Something like this.
sample
# find /directory/~ -exec ls -l {} \;
Almost all sites used this style of writing, but I wasn't sure.
I asked a senior at the company. It seems that you should add the -delete option at the end.
sample
# find /directory/~ -delete;
This is easier, isn't it?
that's all.