renames files with logic