move file time and dos attribute setting logic into new function