Can I get the list of TV episodes of IMDB, Wikipedia etc, copy it to a text file and have it rename the video files in order? Is this possible? How would I go about this?
Can I get the list of TV episodes of IMDB, Wikipedia etc, copy it to a text file and have it rename the video files in order? Is this possible? How would I go about this?
Yes it is possible and you can. Either you create a Windows form app or just a console. For this case i imagine a GUI is not needed. Basically you are going to want to take advantage of the classes and methods in System.IO
You are going to want to read in the textfile and parse it, as you go through each line, assuming that is how each episode name is separated. you are going to want to first check that it contains only valid filename characters and if not make it a valid filename by replacing invalid characters with things like a space,underscore , or hyphen. You may even want to check that the total filename will not exceed (255 characters? i think, i dont remember the max for filenames, but 255/256 sounds right)
you can either store all of these episode names in an array or of the sort, or you can use it right when you read it in and start renaming your files. I would store the episode names into an array first. Then read in all of the video files in the directory that you want to rename, you are going to want to sort those video files in some way if it requires it, like say for instance you want to sort it by date modified or something... then just go through each video file in the order you want and start renaming it with the episode names read in from the text file.
'to read the textfile you can use
Dim newFileNames() As String = System.IO.File.ReadAllLines("C:\episodeslist.txt")
'alt. you can use a stream reader too depending on your situation and preference
'to get the file names from a directory you can use
Dim oldFiles() As String = System.IO.Directory.GetFiles("c:\videos\", "*.avi")
'you can exclude the search pattern if its not needed
'for renaming the file you can use
System.IO.File.Move("C:\Testing\videofile.avi", "C:\Testing\newnamevideofile.avi")
'alt. you can also use
My.Computer.FileSystem.RenameFile("C:\Testing\videofile.avi", "newnamevideofile.avi")
And of course the code i just provided is just samples of methods you can use to accomplish this, you are going to have to write the logic with if statements, loops and what not.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.