-2

I have a folder of log files recorded as XML. A guy in here made a mess in there and changed the script of creation of those files and insert a 'p' letter at the beginning. E.g.:

The file name is now: p0154656450103.xml

When it should be: 0154656450103.xml

There are about 3,000 files this way. How can I rename them erasing just the first character or just the 'p' character?

TigerhawkT3
  • 46,954
  • 6
  • 53
  • 87
SnowBG
  • 91
  • 2
  • 12

1 Answers1

4

You can use os.rename:

import os    
os.rename(src, dst)
coder
  • 12,597
  • 5
  • 34
  • 51