ammartahir1978
asked on
how to zip specific files
hi everyone,
i have this script which BKsupport kindly helped me i want this script to zip the files in the source folder first and then copy the zip file to destination folder.
is that possible?
i have this script which BKsupport kindly helped me i want this script to zip the files in the source folder first and then copy the zip file to destination folder.
is that possible?
Set fso = CreateObject("Scripting.FileSystemObject")
' Set the Folder Locations
sfolder = "\\lts-srv3\public\datadump1\" ' Folder copying from
dfolder = "\\lts-srv1\users\pgoodway\ian data\" 'Folder copying to
zFile = "\\lts-srv1\users\pgoodway\ian data\ZippedFile.zip"
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files
For each folderIdx In files
if folderIdx.DateCreated >= date then
zip sfolder & folderIdx.name, zFile
end if
Next
Function Zip( myFileSpec, myZip )
Dim objZIP
On Error Resume Next
Err.Clear
Set objZIP = CreateObject( "XStandard.Zip" )
objZIP.Pack myFileSpec, myZip, , , 9
Zip = Err.Number
Err.Clear
Set objZIP = Nothing
On Error Goto 0
End Function
Msgbox "Finished"
Open in New Window Select All
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER