3

I'm hoping you can lend me your expertise.

I use shared hosting on Hostgator and need to figure out how to delete all .gz files in multiple directories every hour. I think I have the cronjob command correct to do this for one directory:

/usr/bin/find /path/to/directory/ -type f -name '*.gz' -exec rm {} \;

Is that correct?

If so, how would I perform the same action, but for multiple (i.e. dozens) directories? I'm guessing I can execute one script instead of a bunch of individual cronjob but I'm new to this. What would such a script look like? And how would I execute the script via a cronjob?

Thanks in advance for any assistance!

Glen
  • 33
  • 2

1 Answers1

1

Pass multiple paths to find.

find /dir1 /dir2 ...