removeOldEntries not working

Good day Guys



It seems like the documentCache.RemoveOldEntries is not working please find my code below it is not deleting the files older than 30 minutes.

DocumentCache documentCache = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.for.NET.lic"), “~/testfiles/temp/S/”);
TimeSpan timeSpan = new TimeSpan(0, 30, 0);
documentCache.RemoveOldEntries(timeSpan);


Kind regards
Divan

Hello Divan,


Thank you for the question. You have set incorrect second property in the DocumentCache class. You set: “~/testfiles/temp/S/“
Should be: Server.MapPath(”~/testfiles/temp/S/”)

Best regards.

Good day

I see that it stores documents in different paths I would want to remove all the files older that 30 minutes from the following locations how would I do that


testfiles\temp\Cache\temp\S

\testfiles\temp\Processing\temp\S

testfiles\temp\S


Kind regards
Divan

Hello Divan,


Than you for coming back. To remove all from these three folders (folders themselves remain) you should use such declaration of the DocumentCache class:
DocumentCache documentCache = new DocumentCache(Server.MapPath("~/GroupDocs.Viewer.for.NET.lic"), Server.MapPath("~/testfiles"));

Best regards.

Thank you working 100%

Good day


Am I right in thinking

Server.MapPath("~/testfiles")); will delete all the files in the subfolders older that 30 minutes and leave the folders


Kind regards
Divan

Hello Divan,


Thank you and glad to hear that.

Best regards.

Hello Divan,


Yes, you absolutely right.

Best regards.