Rename all files in the directory where you have "u0026" to "e"

1

I have more than two thousand files with "u0026" in the middle of the names (in this case it would be &) and I need a script that can without in php or batch to rename all keeping the original name by just changing this " u0026 "by" and ", I'm using Windows 10 and the directory for all files is the same.

    
asked by anonymous 15.08.2018 / 19:01

1 answer

1

Can python be?

import os
[os.rename(f, f.replace('u0026', 'e')) for f in os.listdir('.') if not f.startswith('.')]

This script will replace the 'u0026' string with 'and' in all files in the folder that is run.

Powershell also rolls with W10, runs it in the folder you want to rename the files to.

Dir | Rename-Item -NewName {$_.name -replace "u0026","e"}
    
15.08.2018 / 19:17