Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Read zip files? Remove targeted file?

Reply
 
Old 04-12-2007   #1 (permalink)
clintonG


 
 

Read zip files? Remove targeted file?

New to PowerShell and need to know if there is the capability to read
through zip files targeting a specific file extension and removing the
target from each archive?

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/




My System SpecsSystem Spec
Old 04-13-2007   #2 (permalink)
Adam


 
 

Re: Read zip files? Remove targeted file?


"clintonG" <nobody@nowhere.com> wrote in message
news:u1h2A4TfHHA.4636@TK2MSFTNGP03.phx.gbl...
> New to PowerShell and need to know if there is the capability to read
> through zip files targeting a specific file extension and removing the
> target from each archive?


With built-in functions using essentially the Windows zip folders support I
can't seem to do better than do what you want but getting a file comfimation
dialog box for each file to delete:

$shellApp = new-object -com shell.application
$zipFile = $shellApp.NameSpace("full_path_to_zip_file")
$zipFile.Items() | Where { $_.Name -like "*.txt" } | foreach {
$_.InvokeVerb("Delete") }


My System SpecsSystem Spec
Old 04-13-2007   #3 (permalink)
clintonG


 
 

Re: Read zip files? Remove targeted file?

"Adam" <newsadam@gmail.com> wrote in message
news:OvXe5SffHHA.3928@TK2MSFTNGP03.phx.gbl...
>
> "clintonG" <nobody@nowhere.com> wrote in message
> news:u1h2A4TfHHA.4636@TK2MSFTNGP03.phx.gbl...
>> New to PowerShell and need to know if there is the capability to read
>> through zip files targeting a specific file extension and removing the
>> target from each archive?

>
> With built-in functions using essentially the Windows zip folders support
> I can't seem to do better than do what you want but getting a file
> comfimation dialog box for each file to delete:
>
> $shellApp = new-object -com shell.application
> $zipFile = $shellApp.NameSpace("full_path_to_zip_file")
> $zipFile.Items() | Where { $_.Name -like "*.txt" } | foreach {
> $_.InvokeVerb("Delete") }


Hey Adam thanks for responding and choosing to fool around with this one. If
specific file types can be found within zipped archives and deleted that's
good news. Crippleware like AutoCAD litters file systems with .bak files and
network admins will end up zipping many gigabytes of unwanted .bak files
because Autodesk software is GFS and can't be controlled using policies in
this context.

Can you confirm a method to delete the files within the zipped archive which
will also dismiss the dialog or circumvent the dialog altogether? Keeping my
fingers crossed on this one. The point is it will be costly to put a CAD
monkey at the keyboard just to dismiss dialog boxes so it would be right
back to square one for this task.

<%= Clinton


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to read .bak file or .dbk files General Discussion
Remove Read Only on a file in System folder Vista security
Unable to remove read-only attribute from files and folders Vista file management
How to remove read-only property of a file? PowerShell
How to open a file for read/write access in Program Files directory Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46