I am trying to put together a command that will find multiple file types and automatically delete them. I want to run this in a cron every 10 minutes on my server.
I would like to find files of type: .swp, .save, .swo, .maintenance and .bak
Here is my command:
find . -type f -name '*.swp' -o -type f -name '*.save' -o -type f -name '*.bak' -o -type f -name '*.swo' -o -type f -name '*.maintenance'
What would I add to this command to automatically delete these files?
I tried adding -delete at the end, but that doesn't get rid of them:
find . -type f -name '*.swp' -o -type f -name '*.save' -o -type f -name '*.bak' -o -type f -name '*.swo' -o -type f -name '*.maintenance' -delete