NewScriptJunkie Posted February 6, 2015 Author Share Posted February 6, 2015 (edited) Currently working on creating different ways to split the string using regex to create different array Edited February 6, 2015 by NewScriptJunkie 1 Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 6, 2015 Share Posted February 6, 2015 I have made 2 changes in the ListFiles Function1:\ It now process either WMA or MP3 filesOld If Col.type = "Windows Media Audio file" Then New If Col.type = "Windows Media Audio file" Or Col.type = "MP3 Format Sound" Then 2:\ Replace the replaceOld D2 = D1 & "\" & Replace(Obj(2),")).wma","")New D2 = D1 & "\" & Left(Obj(2),Len(Obj(2))-6)Updated Function Function ListFiles(D) Dim D1, D2, D3 For Each Col In D.Files If Col.type = "Windows Media Audio file" Or Col.type = "MP3 Format Sound" Then If InStr(Col,"(") Then'-> Where The Name Get Split And Then Make The Folder Name Obj = Split(Col.Name,"(") D1 = Loc & "\"& Obj(1) ' WScript.Echo D1 If Not Fso.FolderExists(D1) Then Fso.CreateFolder(D1) D2 = D1 & "\" & Left(Obj(2),Len(Obj(2))-6) ' WScript.Echo D2 If Not Fso.FolderExists(D2) Then Fso.CreateFolder(D2) D3 = D2 & "\" & Obj(0) If Not Fso.FolderExists(D3) Then Fso.CreateFolder(D3) ' WScript.Echo D3 Fso.CopyFile Col.Path, D3 & "\" & Col.Name, True Fso.DeleteFile Col,True End If End If Next MsgBox "Completed Procssing Wma Files In This Folder" & vbCrLf & _ Fso.GetFolder(".").Path,4128,"Music Processing" End FunctionQuote NewScriptJunkie Is there a type video or txt version of the same?Just create a script that echos out the Col.type and than use that in the if statement. 1 Link to comment Share on other sites More sharing options...
NewScriptJunkie Posted February 8, 2015 Author Share Posted February 8, 2015 (edited) Hi GunSmokingMan, Yes it would be either mp4 or avi files (only). I mention txt files just to understand the context. Even though it's in quotations how does it know the file type? How is the data being put into the array as "windows media audio file" But awesome I understand making a script to echo out the type. Will do that as soon as I'm on my laptop. Thank you Edited February 8, 2015 by NewScriptJunkie Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 8, 2015 Share Posted February 8, 2015 NewScriptJunkie here are 2 VBS scripts tp help you find out the file types. Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Obj'-> Loop Threw The Files In Parent Folder Only For Each Obj In Fso.GetFolder(".").Files'-> Echo Out The File Type WScript.Echo Obj.Type Next Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Col, Obj'-> Loop Threw The Files In Parent Folder Only For Each Obj In Fso.GetFolder(".").Files'-> Collect All The File Type Col = Col & vbCrLf & Obj.Type Next '-> Display All File Type In One Self Closing Messagebox CreateObject("WScript.Shell").Popup _ "VBS File Type Return" & vbCrLf & Col,10,"Results Of Type Script",4128 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now