Automatically zip directory ?

HI
I am looking how to zip a directroy and its sub directorys automatically . I have got phzip for dos working well for a file but i also neeed to zip a whole directory automatically.

thanx Craig
LVL 4
CraigLazarAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Richie_SimonettiIT OperationsCommented:
Optionally, you could get a great funcionality with a free component at
http://www.vbaccelerator.com/codelib/zip/zipvb.htm
0
 
CraigLazarAuthor Commented:
Hi Guys
Well i need something that is behind the scenes so the usr does not even know i am backing up there directory,
i looked at the links u put up here and it looks like all of them have an interface.

thanx for the quick response

Cheers

Craig
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Richie_SimonettiIT OperationsCommented:
No, pal, vbaccelerator hasn't user interface. It is a dll.
0
 
CraigLazarAuthor Commented:
ok sorry about that , i have another look
0
 
CraigLazarAuthor Commented:
Hi Richie
found it - looks great !!!
but can it zip a directory and all the subfolders and files ?
i had a look at the documentation and all i couls see was backing up a file ????


thanx allot for the help


Craig
0
 
Richie_SimonettiIT OperationsCommented:
Yes. It is on documentation. One advise, use only the neccesary code, ( i mean, if you will not use some features, edit .cls files)
This classes have too many callbacks and sometimes VB doen't like it.
Cheers
0
 
CraigLazarAuthor Commented:
thanx
i will give it a bash
:)
Craig
0
 
Richie_SimonettiIT OperationsCommented:
Ups! i meant, .bas files.
Cheers
0
 
CraigLazarAuthor Commented:
ok thanx Richie
sorry i have not had time to get stuck into it - so i am going to give you the points - is it ok that when i get onto it if i need anyhelp i can ask you ?

cheers

Craig
0
 
Richie_SimonettiIT OperationsCommented:
Don't accept my comment until you get a working code.
Yes, you can ask me anytime.
0
 
CraigLazarAuthor Commented:
Hi
ok - if i do not get to it by the end of next week i will answer it (fair ??)

thanx

Craig
0
 
Richie_SimonettiIT OperationsCommented:
NO. Just let me know what problem you should get and i should try to solve it.
0
 
CraigLazarAuthor Commented:
thanx Richie
have a good weekend
:)

Craig
0
 
CraigLazarAuthor Commented:
Hi Richie
Sorry for getting back t this question so late but been overseas on business.

Ihave moved back onto the project i need this for so i will keep in touch with how thigs go

thanx allot
:)

Craig
0
 
Richie_SimonettiIT OperationsCommented:
You are welcome (back!)!
0
 
CraigLazarAuthor Commented:
Hi there Richie
Ok i managed to steel some time and try and get my little app up and running
ok i tried the vb Accelerator sample and it works.
However what i am struggling with is to first loop thru the file catalog i have choosen. ie lets say i want to back up all the files in the following dir c:\prolink\*.*
now there are say 2 sub dirs in this directory, i need to first loop thru all the records in all the sub dirs and compare them to a database list to verify if a file has been changed and needs to be backed up, then i want to copy the file to my backup dir and then run zip utility.

i am just stuck trying to get the app to pick up all subdirs and there file. Say a user adds a new sub directory in there, i need to pcik it up , update the db that there are new files and then copy them to the backup dir

any ideas ?

thanx allot
Craig ?
0
 
Richie_SimonettiIT OperationsCommented:
Hi Craig, Let me see...
0
 
CraigLazarAuthor Commented:
Hi there
ok i have had to change it and comment out the recirse funtion i am trying to build
here is the code that is giving me hassels or i can't get working
    '***************************************************************************************
    'STEP 1 -
    'Loop thru the Current File Catalog and add it to the File Collection
    Set rsFetch = New ADODB.Recordset
    rsFetch.Open "Select * from tblFFList", cn '
    rsFetch.MoveFirst
    Do Until rsFetch.EOF = True
            tmpFiles = rsFetch("Filepath")
            Col_FileList.Add tmpFiles
            rsFetch.MoveNext
    Loop

    '***************************************************************************************
    'STEP 2 -
    'Now call the Function to Search and retrive the Files from the File Catalog
    Set MasterList = FindFiles(Col_FileList, True)
'''''''    Do Until SubDirs.Count = 0
''''''''        MasterList.Add SubDirs
'''''''        tmpFileCol.Add SubDirs
'''''''        Set SubDirs = Nothing
'''''''        Set Col_VerFileList = Nothing
'''''''        Set Col_VerFileList = FindFiles(tmpFileCol, True)
'''''''        MasterList.Add Col_VerFileList
'''''''    Loop


Public Function ParsePath(Path As String) As String
    Dim a
    'Takes a full file specification and returns the path
    For a = Len(Path) To 1 Step -1
        If Mid$(Path, a, 1) = "\" Or Mid$(Path, a, 1) = "/" Then
            'Add the correct path separator for the input
            If Mid$(Path, a, 1) = "\" Then
                ParsePath = LCase$(Left$(Path, a - 1) & "\")
            Else
                ParsePath = LCase$(Left$(Path, a - 1) & "/")
            End If
            Exit Function
        End If
    Next a
End Function
Public Function FindFiles(Files As Collection, ByVal Recurse As Boolean)
On Error GoTo eh:
    Dim attributes, r
    Dim Result As New Collection

    Dim i As Long
    Dim Path
    Dim IsDir As Boolean
    Dim IsFile  As Boolean
    Dim SubDirFound As String
    For i = 1 To Files.Count
        Debug.Print Files(i)
        'Parse the file specification to find the path
        Path = ParsePath(Files(i))
        'Find the files matching the pattern
        r = Dir$(Files(i), 16)
        Do Until r = ""
            'Add the file to the new file list collection
           
            IsDir = IsDirCheck(Path & r)
             If IsDir = True Then
                'Found a subdirectory in the directory path given, so now add this path to the SubDirs collection
                 SubDirFound = (Path & r & "\*.*")
                 SubDirs.Add SubDirFound
                 IsDir = False
            End If
           
            'Verify if it is a file first before adding it to the main collection
            IsFile = IsFileCheck(Path & r)
             If IsFile = True Then
                Result.Add Path & r
            End If
            'Move on to next file, if one exists
            r = Dir$()
        Loop
    Next i
   
    'If the TempFile Collection is not null, then loop thru it
   
   
   
   
    Set FindFiles = Result
eh:
    If Err.Number = -2147217900 Then
        Resume Next
    End If
End Function


Public Function IsDirCheck(ByVal TmpPath As String) As Boolean
    Dim i As Integer
    Dim Container1 As String
    Dim strLen As Integer
    Dim container2 As String
    Dim CounterStr As Integer
   
    strLen = Len(TmpPath)
    For i = 1 To strLen
        Container1 = Right(TmpPath, i)
        Container1 = Left(Container1, 1)
        If Container1 = "\" Or Container1 = "." Then
            If Container1 = "." Then
                'exit it is a file and not a directory
                IsDirCheck = False
                Exit Function
            Else
                 container2 = Right(TmpPath, i)
                 'Found a directory
                 IsDirCheck = True
                 Exit Function
            End If
'                 CounterStr = (strLen - i)
'                If CounterStr = 3 Then
'                    container2 = Right(TmpPath, 3)
'                    MsgBox "file Found "
'                    IsDirCheck = True
                End If
        'End If
    Next i
   IsDirCheck = False

End Function
Public Function IsFileCheck(ByVal TmpPath As String) As Boolean
    Dim i As Integer
    Dim Container1 As String
    Dim strLen As Integer
    Dim container2 As String
    Dim CounterStr As Integer
   
    strLen = Len(TmpPath)
    For i = 1 To strLen
        Container1 = Left(TmpPath, i)
        Container1 = Mid(TmpPath, i, 1)
        If Container1 = "." Then
            CounterStr = (strLen - i)
            If CounterStr = 3 Then
                container2 = Right(TmpPath, 3)
'                MsgBox "file Found "
                IsFileCheck = True
                Exit Function
            End If
        End If
    Next i
   IsFileCheck = False

End Function
0
 
Richie_SimonettiIT OperationsCommented:
If i remember well, there is a recursesubdirs property from czip class.
0
 
MoondancerCommented:
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20173773.html
http://www.experts-exchange.com/questions/Q.20247869.html
http://www.experts-exchange.com/questions/Q.20253943.html
http://www.experts-exchange.com/questions/Q.20301367.html
http://www.experts-exchange.com/questions/Q.20296324.html
http://www.experts-exchange.com/questions/Q.20296326.html

To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20270469.html

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0
 
CraigLazarAuthor Commented:
Hi
sorry i have left this question open

to the moderators , how can i split these points to everyone who has helped
unfortunately i have been moved of the project again, it has been put on the back shelf.

Sorry Again

craig
0
 
CraigLazarAuthor Commented:
Hi
sorry i have left this question open

to the moderators , how can i split these points to everyone who has helped
unfortunately i have been moved of the project again, it has been put on the back shelf.

Sorry Again

craig
0
 
MoondancerCommented:
Thanks, Craig.  I have processed this point split for you.  Half awarded in this question, the other half here:

Points for Richie_Simonetti -> http://www.experts-exchange.com/jsp/qShow.jsp?qid=20302624

Moondancer - EE Moderator
0
All Courses

From novice to tech pro — start learning today.