Skip to content

Instantly share code, notes, and snippets.

@tanaypratap
Created July 15, 2016 07:24
Show Gist options
  • Save tanaypratap/10217be43024f7deaa83b839be553060 to your computer and use it in GitHub Desktop.
Save tanaypratap/10217be43024f7deaa83b839be553060 to your computer and use it in GitHub Desktop.
## When downloaded some serials have long names like DareDevil.S02.E09
## This program removes the statring Daredevil.S02. from the filename as it is already there on the folder.
import os
folder_path = "D:\\marvel daredevil\\"
file_extension = ".mp4"
episode_number_at_index = 2
for file in os.listdir(folder_path):
name_array = file.split(".")
os.rename(folder_path + file, folder_path + episode_number_at_index + file_extension)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment