Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zipping Certain Files 1

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
Hello Great Ones,

I use the following to zip files and folders. Is there code to zip "specific" files in a folder?

Code:
    Dim strAppName As String    
    Dim FilesToBeZipped As String    
    Dim NameOfNewZipFile As String

    strAppName = "C:\Program Files\WinZip\WINZIP32.EXE"
    
    FilesToBeZipped = "H:\ACCOUNT\CORP_RELO\Databases\"   
     
    Dim toLoc As String   
    Dim newDB As String 
    
    toLoc = "C:\BackUp\Databases\"   
   
    NameOfNewZipFile1 = toLoc1 & newDB

    
    Call Shell(strAppName & " -A -r -P " & NameOfNewZipFile & " " & FilesToBeZipped, 1)

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
FilesToBeZipped = "H:\ACCOUNT\CORP_RELO\Databases\*.mdb"

will only zip up files with a .mdb extension in the folder.

John
 
Ok.

What if all I wanted was db1.mdb and db3.mdb to be zipped into a certain zip file?

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
FilesToBeZipped = chr (34) & "H:\ACCOUNT\CORP_RELO\Databases\db1.mdb" & Chr (34) & " " & chr (34) & "H:\ACCOUNT\CORP_RELO\Databases\db3.mdb" & Chr (34)

- basically you put a space after the first filespec, ensuring it is closed in quotes, open a second double quotemark and add a second filespec.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top