I have a problem, I need a cronjob to chmod a very large directory (with about 20,000 directories which sums up to about 20GB).

I'd would be nice to set the permissions for all files in the directories in real-time, but currently this is not possible.

I'm setting a cron job as:

# chmod all directories
ionice -c3 nice -n19 find /home/user/directory/ -type d -print0 | xargs -0 chmod 0777

# chmod all files
ionice -c3 nice -n19 find /home/user/directory/ -type f -print0 | xargs -0 chmod 0777
However this still consumed very large amounts of resources even with ionice and nice.

Does anyone have any suggestions?