Batch rename files
-
I have a bunch of files I need to prepend with some text.
Is this possible with Pythonista?
Ie.
Filename1 —> pre-text Filename1
Filename2 —> pre-text Filename2
Filename3 —> pre-text Filename3
-
@wayland tou may try this, as a script or as a command
import os; [os.rename(f,'pre_text '+f) for f in os.listdir(path=os.path.expanduser('~/Documents/')) if f.startswith('Filename')]
I'm sure that @ccc will do shorter