1 Answer
1

You should be able to do that easily enough with find. Just run this command in your crontab (this will delete files and sub directories):

find /path/to/target -mtime +14 -delete

From man find

-mtime n
File's data was last modified n*24 hours ago.
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
-delete
Delete files; true if removal succeeded. If the removal failed,
an error message is issued. If -delete fails, find's exit sta‐
tus will be nonzero (when it eventually exits). Use of -delete
automatically turns on the -depth option.

I am not sure if -delete is POSIX but if your implementation of find lacks -delete, you could also use