changing permissions only if there are files