Changing rights and owner in one command to safe resources
0
votes
1
answer
31
views
I have a backup script with the following function:
function change_rights()
{
chown -R ${OWNER}:${GROUP} ${DIR}
find ${DIR} -type f -exec chmod 0640 {} \;
find ${DIR} -type d -exec chmod 0770 {} \;
}
Now the problem is that
${DIR}
is very huge and in order to change the owner and rights I have to traverse the directory at least twice which is extremely resource-intensive.
Is there any way/any command to change the owner **and** rights **at the same time**? That is to say changing what's in the inode in one go?
I'm working on a ext4
file system.
Asked by manifestor
(2563 rep)
Jan 10, 2022, 04:09 PM
Last activity: Jan 10, 2022, 06:43 PM
Last activity: Jan 10, 2022, 06:43 PM