Modifying the code from @Rich ever so slightly and tracking values with MsgBox statements in each part of the code, I did some weird stuff and came up with the following code. Which loops through, and unzips each file and moves the files to the ZipStaging folder. This was the major hurdle.
Public objFSO, objShell, objshellApp
Public SourceFolder, file
Public UserPoint, UserDesktop, UserDocs, ZFFolder, ZSFolder, CZFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
UserPoint = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
UserDesktop = (UserPoint & "\Desktop")
UserDocs = (UserPoint & "\My Documents")
ZFFolder = (UserDocs & "\ZipFonts\")
ZSFolder = (ZFFolder & "ZipStaging\")
CZFolder = (ZFFolder & "CompletedZips\")
Sub DoesZipExist
Set SourceFolder = objFSO.GetFolder(UserDesktop)
FOR EACH file In SourceFolder.Files 'Loop through the user's Desktop folder for files ending with .zip
If Right(LCase(file.Name),4) <> ".zip" Then
KeepLooking = TRUE
Else
KeepLooking = FALSE
Exit FOR
Exit Sub
End If
Next
If KeepLooking = TRUE Then
MsgBox("There are no compressed files (files ending with extension .zip) on your desktop.")
MsgBox("Please click OK to end.")
WScript.Quit
End If
End Sub
Sub InitialFolderCreation
If objFSO.FolderExists(ZFFolder) = FALSE Then
Set SourceFolder = objFSO.CreateFolder(ZFFolder)'Create folder %USERPROFILE%\My Documents\ZipFonts
Set SourceFolder = Nothing
Set SourceFolder = objFSO.CreateFolder(ZSFolder)'Create folder %USERPROFILE%\My Documents\ZipFonts\ZipStaging
Set SourceFolder = objFSO.CreateFolder(CZFolder)'Create folder %USERPROFILE%\My Documents\ZipFonts\CompletedZips
Set SourceFolder = NOTHING
End If
End Sub
Sub MoveFromDesktop 'Move folders from Desktop To ZipFonts folder
Set SourceFolder = objFSO.GetFolder(UserDesktop)
FOR EACH file In SourceFolder.Files 'Loop through the user's Desktop folder for files ending with .zip
If Right(LCase(file.Name),4) = ".zip" Then
'move the file into the %USERPROFILE%\My Documents\ZipFonts folder
objFSO.CopyFile file.Path, ZFFolder, TRUE
objFSO.DeleteFile file.Path
'**figure out how to report that each file is being moved or display some sort of progress bar
'**figure out how to report that file relocation has been completed for a few seconds
End If
NEXT
End Sub
Function Unzip(strFileName,strFolderName)
'Create Shell.Application so we can use the CopyHere method
Set objshellApp = CreateObject("Shell.Application")
'Use CopyHere to extract files
objshellApp.NameSpace(strFolderName).CopyHere objshellApp.NameSpace(FileHolder).Items
Set objfso = Nothing
Set objshellApp = Nothing
End Function
DoesZipExist
InitialFolderCreation
MoveFromDesktop
Set SourceFolder = objFSO.GetFolder(ZFFolder)
FOR EACH file in Sourcefolder.files
FileHolder = file
Unzip FileHolder, ZSFolder
NEXT
MsgBox ("All compressed (.zip) files have been extracted. Ending script.")
Wscript.quit
I know I left out a lot of unused variables and I didn't declare some of them, but I did say I was SuperNoob! Now I need to implement the code that @Rich mentioned to cleanup the temporary files, then I should be good to go!