One thing I have discovered is that 'chmod' is an incredibly slow operation... if you perform it in
a large loop on many files, it will take a long time.
I always start my script with:
umask 0;
And then, if I am creating directories, I say:
mkdir $dir,0777 unless -d $dir;
When I create...