rebuild the structure of files