Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #! /usr/local/bin/python3
  2.  
  3. """ This script is to rename the files
  4. "Friends Season ## Episode ## - *.avi"
  5. to
  6. "Friends S##E## - *.avi"
  7. Example:
  8. This:
  9. "Friends Season 09 Episode 01 - The One Where No One Proposes.avi"
  10. will be changed to:
  11. "Friends S09e01 - The One Where No One Proposes.avi"
  12. """
  13.  
  14. import os
  15. import shutil
  16. import re
  17.  
  18. series_pattern = re.compile(r'^(.*)(Season )(/d{2})( Episode )(/d{2})(.*)$')
  19. sample_string = "Friends Season 09 Episode 01 - The One Where No One Proposes\
  20. .avi"
  21. result = series_pattern.search(sample_string)
  22. print(result.group())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement