This topic contains 5 replies, has 3 voices, and was last updated by
November 23, 2013 at 4:29 am #11631ParticipantTopics: 2Replies: 4Points: 0Rank: Member
OK guys, I have just come across powershell about a week ago, and have been busy playing with it, however I have an issue trying to run write-zip
using the following script,
$src = "z:\orders"
$target = "c:\temp\orders.zip"
Get-ChildItem $src -recurse | Write-zip -outputpath $target
i am getting the following error
Write-Zip : Skipping IAN RUFUS. It is not under the entry path root C:\Users\steve.
At line:3 char:40
+ Get-ChildItem $src -recurse | Write-zip <<<< -outputpath $target + CategoryInfo : NotSpecified: (Z:\orders\Outstanding\IAN RUFUS:String) [W rite-Zip], ArgumentException + FullyQualifiedErrorId : FileError,Pscx.Commands.IO.Compression.WriteZipCommand I have extracted Pscx2.1.1 to my documents folder as suggested in the release notes and run import-module pscx. Any ideas, thanks
November 23, 2013 at 4:44 am #11632MemberTopics: 9Replies: 2322Points: 0Rank: Member
I haven't found the part of the source code that actually produces that error, but there is a parameter named EntryPathRoot that seems like it should solve that problem:
Get-ChildItem $src -recurse | Write-zip -outputpath $target -EntryPathRoot $src
November 23, 2013 at 6:49 am #11634ParticipantTopics: 2Replies: 4Points: 0Rank: Member
that worked, strange thing is i did the same on my works computer and everthing worked ok.
August 22, 2014 at 12:01 am #18255ParticipantTopics: 1Replies: 9Points: 0Rank: Member
I'm having the same error message on a fresh installation (Win Srv 2008, PS 4.0, Pscx 3.1):
Get-ChildItem -Recurse 'S:\Test\SourceDir' | Write-Zip -OutputPath 'S:\Test\\Zippie.zip' -IncludeEmptyDirectories
Write-Zip : Skipping TestFile. It is not under the entry path root C:\
The proposed work around doesn't work either:
$Test = Get-ChildItem -Recurse 'S:\Test\SourceDir' $Test | Write-Zip -OutputPath 'S:\Test\Zippie.zip' -IncludeEmptyDirectories -EntryPathRoot $Test Write-Zip : Cannot convert 'Pscx.IO.PscxPathInfo' to the type 'Pscx.IO.PscxPathInfo' required by parameter 'EntryPathRoot'. Specified method is not supported. At line:2 char:99 + ... -EntryPathRoot $Test .
August 22, 2014 at 3:12 am #18259MemberTopics: 9Replies: 2322Points: 0Rank: Member
That's not quite the proposed workaround. You're passing the results of Get-ChildItem to the EntryPathRoot parameter, but what you should be passing is the same directory name that you passed to Get-ChildItem (in this case, 'S:\Test\SourceDir' ). Try this:
Get-ChildItem -Recurse 'S:\Test\SourceDir' | Write-Zip -OutputPath 'S:\Test\Zippie.zip' -IncludeEmptyDirectories -EntryPathRoot 'S:\Test\SourceDir'
August 22, 2014 at 3:39 am #18260ParticipantTopics: 1Replies: 9Points: 0Rank: Member
Thank you Dave, you're right. I've tried it and it works flawlessly now. Very strange that I have to use this piece:
But I'm glad it works now, thanks again 🙂
The topic ‘Problem using Write-Zip’ is closed to new replies.