Page 1 of 1

Zip delete in subfolder

Posted: Thu Feb 07, 2013 2:33 pm
by AnoPem
Is it possible to delete all files from a folder that contains the same names as files in a zip file ?

Re: Zip delete in subfolder

Posted: Thu Feb 07, 2013 3:03 pm
by clanc789
If you list them you can delete them, if its for updating you can overwritecopy them?

Re: Zip delete in subfolder

Posted: Thu Feb 07, 2013 3:11 pm
by AnoPem
clanc789 wrote:
If you list them you can delete them, if its for updating you can overwritecopy them?
ive been trying to use the unzip function from this http://www.codeproject.com/Tips/257193/ ... ws-Shell32 but whenever theres a files named the same in the directory it prompt me with do you want to overwrite, but i cannot find a way around it

Re: Zip delete in subfolder

Posted: Thu Feb 07, 2013 4:28 pm
by clanc789
Do you know what the file names are? Or are they different because you made an extraction program? If the file names are the same time after again: use my.computer.filesystem.deletefile to delete the requested files and then extract them.

Re: Zip delete in subfolder

Posted: Thu Feb 07, 2013 6:58 pm
by noypikami
i've modify some codes from your project taken from the link that you have provided in codeproject website,

its pretty working now... here's the link to the whole project, its been zip using the project zip itself.



hope this helps...!

http://www.mediafire.com/?1n2j3x1wsxjghp4


ON ZIP additional functions: it zip folders and create the same name of the folder as zip
in the current directory, you can zip the file again and create another
zip file with out deleting the first one in the same directory.

example: original folder name = new
first zip attempt ' name= new.zip
second zip attempt 'name = new2.zip
second zip attempt name = new3.zip and so on with in the same directory.

ON UNZIP additional functions: unzip file and place in the same directory without deleting
the original
zip file
on second attempt if unzip on the same directory it will ask you either to replace or to
create a new set of file.

ON THE OTHER HAND: IF YOU WANT TO delete the original directory, this you have to add
an additional modifications on the button UNZIP button like this
Code: Select all
imports system.io
Code: Select all
My.Computer.FileSystem.deletedirectory(thepathofzipfile) = true
or if you want to delete the files inside a certain directory, do like this
Code: Select all
Dim cc = "the directory of your file"
               Dim dirinfo As New System.IO.DirectoryInfo(cc)
               Dim files() As System.IO.FileInfo
               files = dirinfo.GetFiles("*", IO.SearchOption.AllDirectories)
                For Each file In files
                file.delete()
               next
=============================================================================
=============================================================================