Deleting files older than 7 days

Hi Guys,

I want to delete folder/files older than 7 days. Im using the command below.

find /test/test1 -mtime +7 -print0 | xargs -0 rm -Rf /test/test1/*

which works ok, but it deletes the test1 folder as well which i dont want. The test1 folder will have a list of sub-folders which in turn will have files.I wont know the name of these sub-folders or files. I want to delete these sub -folders and files and preserve the test1 folder.

Any one any ideas.

Help much appreciated. Thanks.

Take a look at:

another way:

cd /test/test1
find . -mtime +7 -exec rm -f {} \;

When i try this which i know should work im weirdly getting

find: missing argument to `-exec'

you might be missing -type f in the command.