SaaS CMS has officially launched! Learn more now.

Remove file version including directories

Vote:
 

Hi,

I'm using a VirtualPathVersioningProvider for a custom folder. I have created multiple versions of files. I'm currently greating a schedules job to remove all the old versions of files. The only version that is not removed is the last added version. See code below. 

var virtualFile = HostingEnvironment.VirtualPathProvider.GetFile(this.GetVirtualFilePath) as VersioningFile;

var orderByDescending = virtualFile.GetVersions().OrderByDescending(x => x.Created);

for (int i = orderByDescending.Count() - 1; i > 0; i--)
{
UnifiedVersion unifiedVersion = orderByDescending.ElementAt(i);

unifiedVersion.Delete();

}

The problem that I am facing now, is that the directories of the versions are not removed, only the file it self. How do I accomplish this?

 

Thanks in advanced,

 

Jeroen Slor

#61805
Oct 02, 2012 13:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.