Free Support Forum - groupdocs.com

removeOldEntries not working


#1

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

#2

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.

#3

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

#4

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.


#5

Thank you working 100%


#6

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

#7

Hello Divan,


Thank you and glad to hear that.

Best regards.

#8

Hello Divan,


Yes, you absolutely right.

Best regards.