electricwizard84
Technical User
Dear all,
I have developed a simple script to rename the filename of a video file according to the TV show name, Season No., Episode number and file extension. The script then renames all files in the directory and increments the episode number by one. For example, the first video is renamed 'Game of Thrones - S01E01.mkv' and the second video is renamed 'Game of Thrones - S01E02.mkv'.
Although the script executes well, i had noticed that the episode numbers that are incremented and added to the filename did not match the number of files in the directory. Thus, the increment skips over some files.
Any thoughts would be much appreciated.
----
Dim sName, source, c, Name, Season, Episode, i
Dim fso
Dim fol
' create the filesystem object
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
' find location of files
source1 = InputBox("Enter video source path:")
source = source1 & "\"
Set fol = fso.GetFolder(source)
Name1 = InputBox("What is the TV Show Name")
Name = CStr(Name1)
Season1 = InputBox("What is the Season No. i.e 01")
Season = CStr(Season1)
Extension1 = InputBox("What is the video extension i.e mp4, mkv, avi")
Extension = CStr(Extension1)
'Episode = Int(1)
Episode = 1
For Each fil In fol.Files
fil.Name = Name & " - S" & Season & "E" & Episode& "." & Extension
Episode = Episode + 1
next
WScript.Echo "Completed!
I have developed a simple script to rename the filename of a video file according to the TV show name, Season No., Episode number and file extension. The script then renames all files in the directory and increments the episode number by one. For example, the first video is renamed 'Game of Thrones - S01E01.mkv' and the second video is renamed 'Game of Thrones - S01E02.mkv'.
Although the script executes well, i had noticed that the episode numbers that are incremented and added to the filename did not match the number of files in the directory. Thus, the increment skips over some files.
Any thoughts would be much appreciated.
----
Dim sName, source, c, Name, Season, Episode, i
Dim fso
Dim fol
' create the filesystem object
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
' find location of files
source1 = InputBox("Enter video source path:")
source = source1 & "\"
Set fol = fso.GetFolder(source)
Name1 = InputBox("What is the TV Show Name")
Name = CStr(Name1)
Season1 = InputBox("What is the Season No. i.e 01")
Season = CStr(Season1)
Extension1 = InputBox("What is the video extension i.e mp4, mkv, avi")
Extension = CStr(Extension1)
'Episode = Int(1)
Episode = 1
For Each fil In fol.Files
fil.Name = Name & " - S" & Season & "E" & Episode& "." & Extension
Episode = Episode + 1
next
WScript.Echo "Completed!