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?
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