iSeries / AS400 FAQ : General : How can I recursively change the owner of objects in the IFS?
Q. I want to change the owner for all the objects in the IFS and recurse into each subdirectory and change the ownership there as well. What’s a good way to do that, since CHGOWN doesn’t recurse? A. This is easy to do in QSHELL. For example, to change everything in directory called /some/dir to be owned by klemscot: STRQSH find /some/dir -exec chown klemscot {} \; Or, maybe when one employee leaves and a new one starts you want to change ownership from one person to another: find . -user mike -exec chown klemscot {} \; (the . means it will work out of the current directory) In fact, you can have any QSHELL command be executed after the “-exec” keyword. The {} is replaced with the name of the file when the command is executed, and the \; tells the find command that it’s reached the end of the command string. So, if you wanted to remove write access to everything in a directory, you might do this: find /some/dir -exec chmod -w {} \; Or, of course, only take write access away from files w
Related Questions
- iSeries / AS400 FAQ : (Category) General : How can I recursively change the owner of objects in the IFS?
- iSeries / AS400 FAQ : (Category) General : How can I recursively change the owner of objects in the IFS?
- iSeries / AS400 FAQ : (Category) Programming : How can I determine the size of objects in the IFS?
- iSeries / AS400 FAQ : General : How can I recursively change the owner of objects in the IFS?
- iSeries / AS400 FAQ : (Category) Programming : How can I recursively delete an IFS directory?
- iSeries / AS400 FAQ : (Category) Programming : How can I recursively delete an IFS directory?