mass rename files (mass rename files), source code collection, page 710612
https://www.purl.org/stefan_ram/pub/mass_renaming_python (permalink) is the canonical URI of this page.
Stefan Ram

Mass renaming of files with Python 

import os
import pathlib
import re

path = r"example"
files = pathlib.Path( path ).glob( r"example" )
for file in files:
oldname = str( file )
newname = re.sub( r"example", r"example", oldname )
print( oldname )
print( newname )
os.rename( oldname, newname )

About this page, Impressum  |   Form for messages to the publisher regarding this page  |   "ram@zedat.fu-berlin.de" (without the quotation marks) is the email address of Stefan Ram.   |   A link to the start page of Stefan Ram appears at the top of this page behind the text "Stefan Ram".)  |   Copyright 1998-2020 Stefan Ram, Berlin. All rights reserved. This page is a publication by Stefan Ram. relevant keywords describing this page: Stefan Ram Berlin slrprd slrprd stefanramberlin spellched stefanram710612 stefan_ram:710612 mass rename files Stefan Ram, Berlin, and, or, near, uni, online, slrprd, slrprdqxx, slrprddoc, slrprd710612, slrprddef710612, PbclevtugFgrsnaEnz Explanation, description, info, information, note,

Copyright 1998-2020 Stefan Ram, Berlin. All rights reserved. This page is a publication by Stefan Ram.
https://www.purl.org/stefan_ram/pub/mass_renaming_python