Chown only where needed / speedup chown

chown

On a folder with millions of files this can take quite a long time:

chown someuser -Rf /folder_with_lots_of_files/

How can I speed this up if 99.9% of those files already belong to someuser?

Best Answer

use the find command, like:

find /folder_with_lots_of_files -not -user someuser -execdir chown someuser {} \+
Related Question