Shell, clear temp folder

Heya guys.

Kinda need a shell script that can clear the content of a folder through cron… Been messing a bit with it myself but it just wont clear it properly.

Wanna remove everything but the .htaccess file … :confused:

If someone could point me in the right direction, I would be very grateful. Thanks.

Nm, sorted it. I forgot about xargs :smiley:

Here’s what it looks like if anyone should need one…


#!/bin/sh
searchdir=/absolute/path/to/your/directory/
find $searchdir \( -name \*\.tmp -o -name \*\.jpg \) -type f | xargs rm -f {}