Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
1.1k views
in CompleteFTP by (120 points)
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?

1 Answer

0 votes
by (162k points)
Have you tried using the substitution macros? e.g %WindowsPath% is the full Windows path of the file.

Categories

...