I'm wanting to use powershell to extract the contents of a zip file to a different directory once a zip is upload, but only for a specific user. Ex:
Filter: /home/bob/*.zip
PS script:
function Expand-ZIPFile($file, $destination)
{
$shell = new-object -com shell.application
$zip = $shell.NameSpace($file)
foreach($item in $zip.items())
{
$shell.Namespace($destination).copyhere($item)
}
}
Expand-ZIPFile -file $args[0] -destination 'c:\temp'
I was assuming args[0] would be the file name of the just uploaded file, but that doesn't seem to be the case. How do I get the file name?