I clear only files, don't remove dir, my script example #!/bin/bash CACHE_DIR='/nginx/temp/proxy' for i in `find ${CACHE_DIR} -type f`; do rm $i ; done Posted at Nginx Forum: http://forum.nginx.org/read.php?2,28335,236947#msg-236947