-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
  • 48,464
  • 6
  • 60
  • 97
SnowBG
  • 89
  • 1
  • 2
  • 12

1 Answers1

4

You can use os.rename:

import os    
os.rename(src, dst)
coder
  • 12,832
  • 5
  • 39
  • 53