We need to change the file permissions and ownerships?

I am running a linux centos server; our php script generates plenty of files in a directory, anything up to 1000 (though too often more).The files in these directories have permissions and ownerships which i need to change.

I have used shell comment for changing the file permission which is working fine but the problem is file increase the directory it will return this message

/bin/sh: /bin/chown: Argument list too long

I understand that this is because the shell is expanding limit so I want to limit the argument count (file count)

I have 2 options

1) I need to write a script which has to list all the files which are created before one month from now. I have used the following comment used but not working

find /var/www/vhosts/domainname.ie/httpdocs/directory/testquotes/test -mtime +1 -exec chown domain.psacln {} \;

2) once we have changed the file permission we need not want to the agreement list how we will limit the files

Kindly Help.

The first problem is you can't tell when a file was created -- only when its content OR its meta-information (ie, permissions) was last modified. The second problem is that your find command checks for files that were modified, in this case, at least 1 day ago; but you want to check for 30 or more days.

Other than that, I see no reason why the find command fails. If you insert an "echo" between "-exec" and "chown", you should see what the find program would have done