I need a bash script (not sure how to write the actual .sh file) which I could set to be run by cron every minute and that would delete files with the name
index.html that are in a specific directory and its subdirectories.
I believe that the following command will do that. However, I need to write it as a script file which I could then have executed via cron.
find /path/to/directory -name "index.html" -print0 | xargs -0 rm -rf
/path/to/directory would be relative to the server root.
My two questions are, do I need a trailing
/ at the end of the path and how do I write the bash script file for example in a file called
I am assuming that I would need to set the file as an executable using
chmod a+x deleteindexes.sh
As regards setting the
cron command, that is not a problem for me.