Write-Zip -RemoveOriginal Issue?

Topics: Developer Forum, User Forum
Nov 9, 2007 at 6:08 PM
I'm having an issue, either through my own misuse or possibly a bug, with the -RemoveOriginal parameter of Write-Zip. My understanding of this parameter is that controls whether or not the original files added to the archive are removed after the archive is successfully written. If this is not its intended purpose, then the rest of this post is invalid.

I'm running the following on a directory that has a large number of log files...

dir *2007* | Write-Zip -Level 9 -RemoveOriginal -OutputPath "2007_Archive.zip"

...I would like the remove all of the files returned once the archive has been created. I've tried the -RemoveOriginal parameter in different orders and not using the pipeline and the original files added to the archive always remain. I've searched this site and googled for anyone else with this problem but have had no luck. So I figure it's either a bug, or I'm using it wrong.


Nov 12, 2007 at 1:47 AM
Hi zigzag,

You're right - it's a bug. To be honest, I started to implement that parameter, then decided it was too dangerous and/or too messy to implement. It's difficult to safely delete files; you would have to wait until the whole archive was written out and verifed before deleting all the files from disk; this would mean storing a list of all input files and then deleting them afterwards. You don't really gain anything from this, as it's just as easy to just delete the files after you've written out the zip yourself. (..and I'd rather you took that responsibility!)

- Oisin
Dec 17, 2007 at 9:58 PM
If it doesn't work why was it shipped? I just hit the same thing as the gzip.exe we normally use will remove the original file by default.
Dec 17, 2007 at 11:46 PM
As stated, it's a bug per-se. It used to work, then was disabled and slipped through the net at release. This is a project done on our spare time, and these things happen. Sorry. It has been removed for 1.2