I am trying to replace a '. ' with a '_' for all files in a directory. The files look like this:
000. utm_homescreen.bak
000. utm_homescreen.yxwz
001. utm_chain_screen.bak
001. utm_chain_screen.yxwz
...
Right now I am trying to apply a split and join to every file in the directory, but I don't see these changes reflected in the file names.
from pathlib import Path
for file in Path('..').glob('*'):
if not file.is_dir():
'_'.join(file.name.split('. '))