Wednesday, October 3, 2007

VBScript - Search and delete MP3 files inside ZIP

'Script start

strDir = "D:\cvc4sp4"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

Set objDir = FSO.GetFolder(strDir)
getInfo(objDir)
Sub getInfo(pCurrentDir)
For Each aItem In pCurrentDir.Files
If LCase(Right(Cstr(aItem.Name), 3)) = "zip" Then
wscript.echo aItem.path
objshell.run "c:\7za d " & aItem.path & " *.mp3" 'Download 7za.exe from internet and place the exe in the specified path. Its free download
End If
If LCase(Right(Cstr(aItem.Name), 3)) = "mp3" Then
wscript.echo aItem.path
aItem.delete(True)
End If
Next
For Each aItem In pCurrentDir.SubFolders
'wscript.Echo aItem.Name & " passing recursively"
getInfo(aItem)
Next
End Sub

'Script End

Queries on customization. Open http://Orangescripts.blogspot.com and post it.

1 comment:

Anonymous said...

Hello, i have a question, this script search mp3 files in all the computer or only in a specific path, and it erase all mp3 files + mp3 zipped files

Thanks

Roger

please answer to roger.guerrero@gmail.com or rjgq@hotmail.com