help on find with chmod.. urgent help needed

Hello to all Unix gurus..

I am writing a generic script which takes the options of unix command as input and concatenate all the pieces and forms a complete executable command.

I am getting an error with the following command as I am resetting my own permission on the root directory. When the complete command is in place. It takes the shape of..

find /applications/inventory/store -name "*" -exec chmod 664 {} \; -print

The command should chmod 664 to all the sub-directories in the main directory store. but once it chmods the store directory. It will not enter into the sub-directories... what's the way out with find command..so that it starts out from the last node on a given PATH.

Besides chmod, this command takes care of few other commands(actions) as well.

Thanks for reading such a big question and hope someone will come out with a solution. :confused:

You will be running into problems here because the command you have run here has removed the exec flag from the files AND directories and so find will not be able to read the contents of the directory. You can do this, but only once...are you really sure that's what you want?

find /applications/inventory/store -name "*" -depth -exec chmod 664 {} \; -print

Thanks borg.. I applied the same solution -depth.. I could see the problem, I can only run it once. The next time the same command will not be executed as it will not have execute permission. Is there a better way of doing the same task.
bye

assuming it is only the files you want to change:

find /applications/inventory/store -type f -exec chmod 664 {} \; -print

Thanks borg for the reply, The task given to me is to chmod directories files, and I am looking for alternate ways of doing that. I am also looking to validate if the person executing the command does have the permission to that, then execute the command.