Add files from different folders locations into one zip file using iLogic

Add files from different folders locations into one zip file using iLogic

darren.lees
Contributor Contributor
500 Views
4 Replies
Message 1 of 5

Add files from different folders locations into one zip file using iLogic

darren.lees
Contributor
Contributor

Hi all (again),

 

As you can sort of deduce from the title....I have some files in different folders which I'd like to place in a single ZIP file in another folder.

 

To elaborate;

Currently, I have a number of DXF files and a PDF which exist in the same folder.

I can create a ZIP file of the complete contents of said folder and save it somewhere else.

 

However, when I need to create another run of the DXF files at a later revision, I completely empty the folder and begin the process of saving the DXFs and PDF to be zipped up again. The ZIP file carries the revision entry in the title.

i.e. OPPN-12-345_DXF Rev A or...Rev B, etc.

This saves having to carry unnecessary DXF files on our system.

 

There is a possible catch......The PDF of the DXFs gets linked within our Information Management & Procurement System and I think we need to keep previous revisions as a fall-back.  As noted previously, I empty the folder on each DXF run.

 

With this in mind, I may need to save the PDF into a different location than the DXFs.
(this isn't a problem)

 

So, my query is.......How can I save files from different locations into the same ZIP file using iLocic

 

I have routines which can generate folder locations, etc. I just don't know the syntax required to complete the ZIPing task.

 

I have looked at the Microsoft website for info, but sadly, can't seem to find what I need.

 

Thank you for any help!!

 

 

0 Likes
Accepted solutions (1)
501 Views
4 Replies
Replies (4)
Message 2 of 5

Frederick_Law
Mentor
Mentor

Use command: tar in command prompt or run it will options in your program.

tar --help for all the options.

Message 3 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

this rule will zip 2 files from different locations in different locations in your zip file.

AddReference "System.IO.Compression.dll"
AddReference "System.IO.Compression.FileSystem.dll"
Imports System.IO.Compression

Using fileStream As New System.IO.FileStream("C:\temp\temp.zip", System.IO.FileMode.OpenOrCreate)
    Using archive As New System.IO.Compression.ZipArchive(fileStream, System.IO.Compression.ZipArchiveMode.Create, True)

		archive.CreateEntryFromFile("C:\temp\bakje.dxf", "subFolder\NewEntry.dxf") 
		archive.CreateEntryFromFile("C:\othe folder\another.dxf", "entry2.dxf") 
		
    End Using
End Using

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 5

darren.lees
Contributor
Contributor

Hi @JelteDeJong ,

 

Thank you for this.

I'll try it out tomorrow 

0 Likes
Message 5 of 5

darren.lees
Contributor
Contributor

And a thank you shout out to @Frederick_Law   

0 Likes