Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.IO
- Imports System.Collections
- Public Class frm_main
- Dim dir_a As String = "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs"
- Dim files() As String
- Dim directories() As String
- Dim sub_directories() As String
- Dim sub_sub_directories() As String
- Dim simfile_counter As Long = 0
- Dim audio_counter As Long = 0
- Dim image_counter As Long = 0
- Dim video_counter As Long = 0
- Dim lyric_counter As Long = 0
- Dim song_filename As String = ""
- Dim song_extention As String = ""
- Public Sub frm_main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- ' these are the current directory and files. meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\FILES"
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORIES"
- directories = Directory.GetDirectories(dir_a)
- ' for all the directories in d...
- For Each d In directories
- ' get the sub directories here for later... meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORIES\SUB DIRECTORIES"
- sub_directories = Directory.GetDirectories(d)
- ' display the current directory we are in. meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORY"
- ' MessageBox.Show("Directory Name is : " + d)
- ' for all sub directories in sd...
- For Each sd In sub_directories
- ' get the sub sub directories here for later... meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORIES\SUB DIRECTORIES\SUB DIRECTORIES"
- sub_sub_directories = Directory.GetDirectories(sd)
- ' display the current sub directory we are in. meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORY\SUB DIRECTORY"
- ' MessageBox.Show("Sub Sub Directory Name is : " + sd)
- files = Directory.GetFiles(sd)
- ' For all files in f...
- For Each f In files
- ' get the files here for later... meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORY\FILES"
- ' sub_files = Directory.GetFiles(f)
- ' display the current file. meaning...
- ' "C:\Users\Jeremy\AppData\Roaming\StepMania 5\Songs\DIRECTORY\FILE"
- ' MessageBox.Show("Filename is : " + f)
- ' see if we found a simfile...
- If Path.GetExtension(f) = ".sm" Then
- Try
- simfile_counter = simfile_counter + 1
- My.Computer.FileSystem.RenameFile(f, "chart_" + Convert.ToString(simfile_counter) + ".sm")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".ssc" Then
- Try
- simfile_counter = simfile_counter + 1
- My.Computer.FileSystem.RenameFile(f, "chart_" + Convert.ToString(simfile_counter) + ".ssc")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".dwi" Then
- Try
- simfile_counter = simfile_counter + 1
- My.Computer.FileSystem.RenameFile(f, "chart_" + Convert.ToString(simfile_counter) + ".dwi")
- Catch ex As Exception
- ' lol nope
- End Try
- ElseIf Path.GetExtension(f) = ".old" Then
- Try
- My.Computer.FileSystem.DeleteFile(f)
- Catch ex As Exception
- ' lol nope.
- End Try
- Else
- ' do nothing.
- End If
- ' see if we found a audio file...
- If Path.GetExtension(f) = ".mp3" Then
- Try
- audio_counter = audio_counter + 1
- My.Computer.FileSystem.RenameFile(f, "song_" + Convert.ToString(audio_counter) + ".mp3")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".ogg" Then
- Try
- audio_counter = audio_counter + 1
- My.Computer.FileSystem.RenameFile(f, "song_" + Convert.ToString(audio_counter) + ".ogg")
- Catch ex As Exception
- ' lol nope.
- End Try
- Else
- ' do nothing.
- End If
- ' see if we found a image file...
- If Path.GetExtension(f) = ".png" Then
- Try
- image_counter = image_counter + 1
- My.Computer.FileSystem.RenameFile(f, "bg_bn_cd_o_" + Convert.ToString(image_counter) + ".png")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".bmp" Then
- Try
- image_counter = image_counter + 1
- My.Computer.FileSystem.RenameFile(f, "bg_bn_cd_o_" + Convert.ToString(image_counter) + ".bmp")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".jpg" Or Path.GetExtension(f) = ".jpeg" Then
- Try
- image_counter = image_counter + 1
- My.Computer.FileSystem.RenameFile(f, "bg_bn_cd_o_" + Convert.ToString(image_counter) + ".jpg")
- Catch ex As Exception
- End Try
- ElseIf Path.GetExtension(f) = ".gif" Then
- Try
- image_counter = image_counter + 1
- My.Computer.FileSystem.RenameFile(f, "bg_bn_cd_o_" + Convert.ToString(image_counter) + ".gif")
- Catch ex As Exception
- End Try
- Else
- ' do nothing.
- End If
- ' see if we found a video file...
- If Path.GetExtension(f) = ".avi" Then
- Try
- video_counter = video_counter + 1
- My.Computer.FileSystem.RenameFile(f, "video_" + Convert.ToString(video_counter) + ".avi")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".mp4" Then
- Try
- video_counter = video_counter + 1
- My.Computer.FileSystem.RenameFile(f, "video_" + Convert.ToString(video_counter) + ".mp4")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".mov" Then
- Try
- video_counter = video_counter + 1
- My.Computer.FileSystem.RenameFile(f, "video_" + Convert.ToString(video_counter) + ".mov")
- Catch ex As Exception
- ' lol nope.
- End Try
- ElseIf Path.GetExtension(f) = ".wmv" Then
- Try
- video_counter = video_counter + 1
- My.Computer.FileSystem.RenameFile(f, "video_" + Convert.ToString(video_counter) + ".wmv")
- Catch ex As Exception
- ' lol nope.
- End Try
- Else
- ' do nothing.
- End If
- ' I forgot about lyric files...
- If Path.GetExtension(f) = ".lrc" Then
- Try
- lyric_counter = lyric_counter + 1
- My.Computer.FileSystem.RenameFile(f, "lyric_" + Convert.ToString(lyric_counter) + ".lrc")
- Catch ex As Exception
- ' lol nope.
- End Try
- End If
- Next f
- ' we should be able to reset the counter after we check all the files.
- simfile_counter = 0
- audio_counter = 0
- image_counter = 0
- video_counter = 0
- lyric_counter = 0
- Next sd
- Next d
- MessageBox.Show("DONE!")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement