Delete log files automatically.

Here is the script I want to run to deleted log files after a certain time:

touch /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs
find /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs -atime +120 - exec rm -rf {}\;

Exerytime I run it, it throws me the error:

find: paths must precede expression: -
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

What is wrong with this script?

There is an extra space character on the line just before exec making the parameter not read as -exec and thus messing up the syntax.

Btw. The command looks a bit ruthless and may not behave as you expect. You have no -type f parameter so this could delete directory trees. I've never had any success with using -atime because my backup software changes that timestamp, and prefer to use -mtime instead.

I have never had reason to issue rm -rf in a script. It is particularly dangerous in timestamp-based processing when the timestamp on a top-level directory is older than the timestamp of the child directories.
For example I have just looked at a mature system where the timestamp on /usr is six years ago.

Is there a better script to accomplish what I am trying to do.

I am trying to delete files out of the log directory automatically every 120 days.

The reason for this is because if they are not deleted then we will get a warning letting us know that capacity is a 99%

Help would be very appreciated on this topic.