for removing invalid files and add new files