Remove unnecessary files and set file attributes consistently