Jump to content

Copying all subfolder from a folder to another folder


Recommended Posts


I have made 2 changes in the ListFiles Function

1:\ It now process either WMA or MP3 files

Old 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 replace

Old 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 Function
Quote 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.

Link to comment
Share on other sites

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 by NewScriptJunkie
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...