I'm trying to create something to Zip up all files within a directory and its' sub directory using SharpZipLib.
Simply put, you type the name of a directory into a text box and its passed into the creation of an array like so:
That gets all of the files in a single directory and throws them into a string array.
This string array is passed to another procedure which actually does the zipping based on the paths and filenames in this array.
Now to add subdirectories, it should be as simple as creating a recursive procedure to get all the directories and add their files to the strFilesToCompress() array.
Unfortunately I don't know my array technique in this way very well and the code:
Gives an error. Apparently you can only do this when first Dimming it?
what syntax would I use to keep adding more files after its first created?
Would I have to break down and use a For...Next loop to assign each filepath a specific spot in the array?
Simply put, you type the name of a directory into a text box and its passed into the creation of an array like so:
Visual Basic:
Dim strFilesToCompress() as string = IO.Directory.GetFiles(inputbox.text)
That gets all of the files in a single directory and throws them into a string array.
This string array is passed to another procedure which actually does the zipping based on the paths and filenames in this array.
Now to add subdirectories, it should be as simple as creating a recursive procedure to get all the directories and add their files to the strFilesToCompress() array.
Unfortunately I don't know my array technique in this way very well and the code:
Visual Basic:
For Each directory In IO.Directory.GetDirectories(SourceDirectory)
strFilesToCompress() += IO.Directory.GetFiles(directory)
zipDirectory(directory) 'The recursive part
Next
Gives an error. Apparently you can only do this when first Dimming it?
what syntax would I use to keep adding more files after its first created?
Would I have to break down and use a For...Next loop to assign each filepath a specific spot in the array?