I need to change file names inside a folder
My file names are
BX-002-001.pdf
DX-001-002.pdf
GH-004-004.pdf
HJ-003-007.pdf
I need to add an additional zero after '-' at the end, like this
BX-002-0001.pdf
DX-001-0002.pdf
GH-004-0004.pdf
HJ-003-0007.pdf
I tried this
all_files = glob.glob("*.pdf")
for i in all_files:
fname = os.path.splitext(os.path.basename(i))[0]
fname = fname.replace("-00","-000")
My code is not working, can anyone help?