Solved

Extract all Files from a Zip but not any folders

Posted on 2014-03-05
3
282 Views
Last Modified: 2014-03-10
The code below works and will extract all files and folders from a zipped file. If possible I would like it to only extract the files.

Function unZip()
 
Dim unZipToLoc As Variant
Dim zipFname As Variant
   
     unZipToLoc = "C:\Zipped"
     zipFname = DLookup("ZippedReportsName", "tDefaults")
     
Set oApp = CreateObject("Shell.Application")
 
     oApp.Namespace(unZipToLoc).CopyHere oApp.Namespace(zipFname).Items
     
End Function
0
Comment
Question by:Hiken
  • 2
3 Comments
 
LVL 35

Assisted Solution

by:Kimputer
Kimputer earned 500 total points
Comment Utility
Dim unZipToLoc As Variant
Dim zipFname As Variant
    
     unZipToLoc = "C:\Zipped"
     zipFname = DLookup("ZippedReportsName", "tDefaults")
      
	Set oApp = CreateObject("Shell.Application")
	Set FilesInZip = oApp.Namespace(zipFname).Items	
	FilesInZip.Filter 64, "*.*"
    oApp.Namespace(unZipToLoc).CopyHere(FilesInZip)
     
End Function

Open in new window

0
 

Author Comment

by:Hiken
Comment Utility
it is not erroring out but it doesn't unzip any files.  There are four folders inside the zip before the text files so it looks like this:


ZippedAll.zip\scowebreports\reports\FB6122\2014068\  then the text files.  The last folder 2014068 changes daily.
0
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
Comment Utility
Because you said "only files", I understood is as only the files in in the root folder.
In this case, it's better to unzip as normal (use your old code), and then add code to recursively move files from the subfolders to the root folder, and delete the subfolders after that.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

744 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

17 Experts available now in Live!

Get 1:1 Help Now