refactor $file -> $basename
refactor: do not overwrite $name !!
refactor