jim if you print the variable results, you'll see there's a quote in the wrong place.
"C:\Documents and Settings\jamesshaffer\My Documents\7-Zip\7za.exe" a "F:\mtv\secure\Construction\Access\All Database Backup\2012-Oct_Backup\"12-10-23.zip F:\mtv\secure\Construction\Access\CPAS
i've corrected your vbs code below to build the path correctly:
--"C:\Documents and Settings\jamesshaffer\My Documents\7-Zip\7za.exe" a "F:\mtv\secure\Construction\Access\All Database Backup\2012-Oct_Backup\12-10-23.zip" "F:\mtv\secure\Construction\Access\CPAS\"
' Need to create a full path following the Target Location:
' Higher Level Folder: "YYYY-MMM_Backup"
' File Name "YY-MM-DD.Zip"
' Backing up the "CPAS folder and all its subfolders"
Dim YYYY
Dim YY
Dim MMM
Dim MM
Dim DD
Dim strZipInstruction
Dim strZipProgLoc
Dim strTargetLoc
Dim strSourceLoc
Dim FileNameZip
Dim strDate
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
YYYY = CStr(Year(Date))
YY = Right(YYYY, 2)
MM = FormatNumber((Month(Date)), 0, -1)
MMM = Left(MonthName(Month(Date)), 3)
DD = FormatNumber(Day(Date), 0, -1)
strTargetLoc = "M:\mtv\secure\Construction\Access\All Database Backup\" & YYYY & "-" & MMM & "_Backup\"
If Not oFSO.FolderExists(strTargetLoc) Then
'oFSO.CreateFolder strTargetLoc
End If
strTargetLoc = """M:\mtv\secure\Construction\Access\All Database Backup\" & YYYY & "-" & MMM & "_Backup\"
strSourceLoc = """M:\mtv\secure\Construction\Access\CPAS\"""
strZipProgLoc = """C:\Documents and Settings\jamesshaffer\My Documents\7-Zip\7za.exe"" a "
strDate = YY & "-" & MM & "-" & DD
FileNameZip = strDate & ".zip"""
strZipInstruction = strZipProgLoc & strTargetLoc & FileNameZip & " " & strSourceLoc
'Debug.Print strZipInstruction
MsgBox strZipInstruction
Lowell