Unzip file from thumbdrive to c:\ drive

Author Message
longbow22

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 12/19/2011
  • Status: offline
Unzip file from thumbdrive to c:\ drive Wednesday, December 21, 2011 4:28 AM (permalink)
0
Hello All
This is my 1st post, well 3rd the other 2 got messed up. on my desktop pc when I click Post New Thread a box pops up but it is blank.
This is also my first attempt at vbs. Not sure how the NameSpace stuff works.
I am trying to unzip a file that is on my ThumbDrive to my harddrive however i get an error:
Object required: 'objShell.NameSpace(...)'
on this line
objShell.NameSpace(strFolderName).CopyHere objShell.NameSpace(strFileName).Items
Full Code:
Function Unzip(strFileName,strFolderName)
Dim ParentFolder
Dim objShell
Dim objFSO
Dim objFolder
' For this to work we need to zip the CONTENTS of C:\Rent Roll not including the main folder name C:\Rent Roll
ParentFolder = "C:\"

' Create Shell.Application so we can use the CopyHere method
Set objShell = CreateObject("Shell.Application")

' Create FileSystemObject so we can use FolderExists and CreateFolder if necessary
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Create folder to receive files if it doesn' t already exist

If objFSO.FolderExists(strFolderName) Then
Wscript.Echo "Folder exists."
'BackupFiles strThumbDrive,strFromDir,strToDir
Set objFolder = objShell.NameSpace(ParentFolder)
Set objFolder = objFSO.GetFolder(strFolderName)
objShell.NameSpace(strFolderName).CopyHere objShell.NameSpace(strFileName).Items
Wscript.Echo "Unzipped the new version of the Rent Roll to C:\Rent Roll"
Else
Wscript.Echo "Folder does not exist."
install = MsgBox ("Tenant Tracker not installed..." & Chr(13) & "Click Ok to install or Cancel to quit...",1)
If intall = vbOk Then
Set objSoftware = objService.Get("Win32_Product")
errReturn = objSoftware.Install(objFSO.GetParentFolderName(objFile) & "TenantTracker2011Full.msi", , ALL_USERS)
Else
WScript.Quit
End If
End If

Set objFSO = Nothing
Set objFolder = Nothing
Set objShell = Nothing

End Function
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9