SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    zip file and password protect it

    Guys,

    I need zip and password protect a file. I have a directory in which a file will be placed on a daily basis. I need vb code that zips and password protects the zipped filed. the zipped file will inherit the unzipped file name. the file name will be the password.

    I need this code for windows server 64bit or 32 bit. I need to run it from a scheduled task.

    Unfortunately my vb is crap so I'm not sure how to code it.


    thanks

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ma201dq View Post
    Guys,

    I need zip and password protect a file. I have a directory in which a file will be placed on a daily basis. I need vb code that zips and password protects the zipped filed. the zipped file will inherit the unzipped file name. the file name will be the password.

    I need this code for windows server 64bit or 32 bit. I need to run it from a scheduled task.

    Unfortunately my vb is crap so I'm not sure how to code it.


    thanks
    Just wanted to mention that its got to be vbs rather than vb

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ma201dq View Post
    Just wanted to mention that its got to be vbs rather than vb
    I now have some code that zips a file, but how can i modify it such that it
    1) it dynamially picks the file in the directroy to zip
    2) passwords protect it using the name of the file
    3) works with large files


    here is the code:

    Code:
    Const FOF_CREATEPROGRESSDLG = &H0&
    
    Const File1 = "C:\files\test.txt"
    
    Const MyZip = "C:\files\test.zip"
    
    
    CreateObject("Scripting.FileSystemObject") _
    .CreateTextFile(MyZip, True) _
    .Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
    
    
    '-------------- zip ---------------------------
    
    'get ready to add files to zip
    With CreateObject("Shell.Application")
    
    'add files
    .NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG
    
    .NameSpace(MyZip).CopyHere File2
    
    End With
    wScript.Sleep 1000
    
    wscript.echo "Done!"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •