web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Automate Tv Show/serie...
Power Automate
Unanswered

Automate Tv Show/series subtitles Renaming with Power Automate

(0) ShareShare
ReportReport
Posted on by 34

If you download Tv Show/series from Torrent or other Online Platforms, especially from rarbg torrent sites. Most of the time there are many subtitle files in many different languages for each episode in a separate folder. organize and renaming them for use are time-consuming and painful. Hope this will Help.

Folder Structure for this Flow:

Folder Structure.jpg

Flow Creation:

Create 3 input variables to enter Tv Show/series location, subtitle language and subtitle type you want. (ref:images: "input variable 1.jpg","input variable 2.jpg"and "input variable 3.jpg")

Copy the text and paste it on Flow.

input variable 1.JPG

input variable 2.JPG

input variable 3.JPG

# process 1: start deleting any folder that does not contain subtitles. (*.srt files)
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Subfolders
LOOP FOREACH Subfolder IN Subfolders
Folder.GetFiles Folder: Subfolder FileFilter: $'''*.srt''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
IF Files.Count = 0 THEN
Folder.Delete Folder: Subfolder
END
END
# process 1: end
# Process 2: start moving subtitles containing folders to Main Folder. (from a folder That contains all subtitles containing folders)
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Subfolders
LOOP FOREACH Subfolder IN Subfolders
Folder.GetSubfolders Folder: Subfolder FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> SubSubfolders
END
LOOP FOREACH Subfolder IN SubSubfolders
Folder.Move Folder: Subfolder Destination: FolderPath
END
# Process 2: end
# Process 3: declare all moved folders as "Subfolder" (variable). and delete the Empty once.
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Subfolders
LOOP FOREACH Subfolder IN Subfolders
IF IsEmpty(Subfolder) THEN
Folder.Delete Folder: Subfolder
END
END
# Process 3: end
/# Process 4: declare all folders under MainFolder as "Folders" (variable).
(here we just moved desired language subtitle file from folder to the main folder, delete the remaining files on the folder and move back desired language subtitle file on the folder)#/
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders
LOOP FOREACH Folder IN Folders
Folder.GetFiles Folder: Folder FileFilter: $'''*%MyLanguage%*.srt''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> FilesESrt
File.Move Files: FilesESrt Destination: FolderPath IfFileExists: File.IfExists.DoNothing MovedFiles=> MovedFiles
Folder.GetFiles Folder: Folder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
File.Delete Files: Files
File.Move Files: MovedFiles Destination: Folder IfFileExists: File.IfExists.DoNothing
END
/# Process 4: end
#/
/# Process 5: sometimes there are multiple subtitles in some languages. some subtitle contains just voices, some are just translations and some contains everything including background descriptions, voices, and translations. The more subtitle contains the bigger its memory size becomes.
So Process 5 will keep the one you choose and filter out the rest.#/
LOOP FOREACH Folder IN Folders
Folder.GetFiles Folder: Folder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.Size SortDescending1: True SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
IF SubtitlesChoose = $'''Everything''' THEN
File.Delete Files: Files[1:]
END
IF SubtitlesChoose = $'''Voice''' THEN
IF Files.Count = 1 THEN
File.Delete Files: Files[1:]
END
IF Files.Count = 2 THEN
File.Delete Files: Files[0]
END
IF Files.Count >= 3 THEN
File.Delete Files: Files[0]
File.Delete Files: Files[2:]
END
END
IF SubtitlesChoose = $'''Other''' THEN
IF Files.Count = 1 THEN
File.Delete Files: Files[1:]
END
IF Files.Count = 2 THEN
File.Delete Files: Files[0]
END
IF Files.Count >= 3 THEN
Folder.GetFiles Folder: Folder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.Size SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
File.Delete Files: Files[1:]
END
END
END
/# Process 5: end
#/
# Process 6: move video file to same name Folder (that contain its subtitle).
Folder.GetFiles Folder: FolderPath FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> videofiles
LOOP FOREACH Folder IN Folders
LOOP FOREACH Videofile IN videofiles
IF Folder.Name = Videofile.NameWithoutExtension THEN
File.Move Files: Videofile Destination: Folder IfFileExists: File.IfExists.DoNothing MovedFiles=> MovedFiles
END
END
END
/# Process 6: end
#/
# Process 7: rename subtitle as folder name.
LOOP FOREACH Folder IN Folders
Folder.GetFiles Folder: Folder FileFilter: $'''*.srt''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
File.RenameFiles.Rename Files: Files NewName: Folder.Name KeepExtension: True IfFileExists: File.IfExists.DoNothing
END
# Process 7: End
# Flow End.

Flow.png

An alternative way to do process 4: it will take a lot more time but still you this if you need:

/# Process 4: declare all folders under MainFolder as "Folders" (variable). and start deleting the other language subtitle files except for the desired subtitle language file.
Enter the preferred language on the input variables "MyLanguage"
#/
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders
LOOP FOREACH Folder IN Folders
Folder.GetFiles Folder: Folder FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
LOOP FOREACH File IN Files
IF NotContains(File.Name, MyLanguage, True) THEN
File.Delete Files: File
END
END
END
/# Process 4: end
#/

Alternative way to do process 4.JPG

enjoy!

 

  • mevo Profile Picture
    34 on at

    For test example you download tv show

    The.Midnight.Club.S01 magnet link:

    magnet:?xt=urn:btih:D6B827356C88F397824267B380C904297D4F1413&dn=The.Midnight.Club.S01.1080p.WEBRip.x265-RARBG&tr=udp%3a%2f%2ftracker.trackerfix.com%3a80%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2720%2fannounce&tr=udp%3a%2f%2f9.rarbg.to%3a2720%2fannounce&tr=udp%3a%2f%2ftracker.thinelephant.org%3a12710%2fannounce&tr=udp%3a%2f%2ftracker.slowcheetah.org%3a14710%2fannounce

     

    Gangs.of.London.S01 magnet link:

    magnet:?xt=urn:btih:5CDD02E0564A22FC027076408978B3FE0D55D683&dn=Gangs.of.London.S01.1080p.BluRay.x265-RARBG&tr=udp%3a%2f%2ftracker.trackerfix.com%3a80%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2720%2fannounce&tr=udp%3a%2f%2f9.rarbg.to%3a2720%2fannounce&tr=udp%3a%2f%2ftracker.fatkhoala.org%3a13710%2fannounce&tr=udp%3a%2f%2ftracker.slowcheetah.org%3a14710%2fannounce

     

     

     

  • VJR Profile Picture
    7,635 on at

    @mevo you can create a cookbook post here with the details of your solution for better visibility.

     

  • mevo Profile Picture
    34 on at

    Hi, @VJR your help from the previous help post really help me to finish this project.

    So Thank you!! and also for pointing this out.

    if i post this on the cookbook post, do i have to add more details on the cookbook post or just copy/paste this?

    should i delete this post from here? if so how do i do that?

     

  • mevo Profile Picture
    34 on at

    Hi, @VJR your help from the previous help post really help me to finish this project.

    So Thank you!! and also for pointing this out.

    if i post this on the cookbook post, do i have to add more details on the cookbook post or just copy/paste this?

    should i delete this post from here? if so how do i do that?

  • mevo Profile Picture
    34 on at

    @VJRcreate a cookbook post there as you suggest. it's not showing and is marked as spam.

    do you have any solution?

    link: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Auto-Renaming-Tv-Show-series-subtitles-with-Power-Automate/m-p/1831842

    1.JPG

  • VJR Profile Picture
    7,635 on at

    I think the cookbook page detected words like Tv and series and thought of it as possible spam. You can use the Abuse report button and inform that it is not spam.

    You can keep this post as it is, not needed to delete.

  • mevo Profile Picture
    34 on at

    I reported this as you suggested. hope I'll get notified soon. Thank you!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 249 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 202

#3
David_MA Profile Picture

David_MA 180 Super User 2026 Season 2

Last 30 days Overall leaderboard