We had a situation in the company this week which required us to deliver the whole EPiServer virtual path provider file structure to the client – zipped. Easy enough… go to the EpiServer VPP directory and… well… ok… hmm… so the path provider is versioning and as a consequence the physical organization of files on the disk does not make any sense for a human trying to browse it.
Fine! So let’s create a native provider and do a copy and paste within the file manager…. hmm an exception complaining about the provider incompatibility…
Naturally, my knee-jerk reaction is – let’s do it with the PowerShell… which I recall was doing something like this in it’s previous version… The example I’ve tested and placed in the “Samples” tab was:
cd VPP:\ cd \Documents\ get-childitem -recurse | copy-item -destination \DocumentsNonVersioningVPP\
This worked well but flattened the directory structure – in other words useless for our client.
I’ve tried what should work in a plain PowerShell:
cd VPP:\ copy-item -path vpp:\Documents\* -destination vpp:\DocumentsNonVersioningVPP\ -recurse -force
Now that didn’t work at all, and turned out to be a bug in my PowerShell plugin’s PSDrive provider. Unfortunately when I attempted to fix it by implementing the copy in the naive way – using UnifiedDirectory’s Copy method I’ve run into the same exception about incompatibility between the classes that I’ve seen when trying to copy the files form the file manager.
Mmmkay… I’ll just implement the recursion myself…
A quarter later the new version of PowerShell plugin is operational and… I have an excuse for another blog post.
Additionally – since the client solution required it – this version will be compatible with a wider variety of EPiServer versions as it had to be compiled against build 5.2.375.133 instead of 5.2.375.236.
When downloading the plugin
always look for the latest blog post about it to get the most recent version!
How to install?
Extract the DLL form the ZIP file into the BIN folder of your web application to install the plugin. Remove the DLL to uninstall it.
All feedback appreciated!
In lieu of the regular disclaimer:
You ask: why is so much of our science dangerous?
I say: why not marry safe science if you love it so much. In fact, why not invent a special safety door that won’t hit you in the butt on the way out, because YOU ARE FIRED!
Yes you, box your stuff, out the front door, parking lot, car, goodbye.
This entry (Permalink) was posted on Thursday, August 18th, 2011 at 5:07 pm and is filed under .Net Framework, ASP.NET, C#, Code Samples, Downloadable, EPiServer, PowerShell, Software, Software Development, Web applications. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.