Solved

Extract all Files from a Zip but not any folders

Posted on 2014-03-05
3
290 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
ID: 39913830
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
ID: 39917250
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
ID: 39917354
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

839 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