#!/bin/bash # Recursively delete directories by age (14 days), and only exactly at the depth of the base directory find /path/to/base/dir/* -type d -mindepth 1 -maxdepth 1 -ctime +14 -exec rm -rf {} \;