Solved

how to zip specific files

Posted on 2008-09-30
2
435 Views
Last Modified: 2012-05-05
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?

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

Open in new window

0
Comment
Question by:ammartahir1978
2 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 22606416
To copy the zip file you should be able to add this below line 17:


If fso.FileExists(zFile) Then

    fso.CopyFile zFile, dfolder

End If

Open in new window

0
 

Author Comment

by:ammartahir1978
ID: 22711087
but that script zip everything instead for some specific filei want how can i achive that??
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now