Cleanup compared files

Our main use case for comparison is to only compare file difference and read only. While this works, I noticed that the comparing files and resultant files remains in the working directory. I want to be able to clean this up conveniently. Do you have a recommendations on how to go about this?


One way that I can think of is to have the ability to group the compared files by date as a placeholder for the comparison files. This way I can perhaps write a cleaner in the near future to remove directories say from yesterday and earlier or any other time driven cleanup.

Is this something that we can do?

Some recommendation and guidance is also welcome.

Thanks.


Leo

Hello Leo,


Thank you for the request. Yes, the way that you suggested is the best way to achieve one’s aim. You will have well sorted storage (folders names can be a date and time of the comparing) and you will be able to create a “cleaner” which will read folders names in a simple loop and check if the date is acceptable for the deleting filter - delete it.

To store result files of comparing in different folders you can use such code example:

To create folder:
string folderName = string.Format("{0:yyyy-MM-dd}",
DateTime.Now.ToString(“yyyy-MM-dd”));
pathToSave = Server.MapPath("~/App_Data/" + folderName);
if (!Directory.Exists(pathToSave))
{
Directory.CreateDirectory(pathToSave);
}
Then to save result file in it use such code in the Comparison widget:
.ResultFileName(this.pathToSave + “/Redline.doc”)

Thank you.

Hi Pavel,


Thank you for the reply.

This is very helpful.

One more question, what happens to the directory structure under the temp files. Will it use the same pattern as the ResultFileName? That is, under the temp (Cache/Processing) folders will also have the date/time folder structures.

By the way, does annotations follow the same organization just as you described?


Thanks.


Hello,


Yes, the folder structure in the temp folder will have same date/time structure, for example: temp/Cache/Redline.doc/2015-04-27T14_13_54

As for Annotation - yes, it’s follow same organization, because the reason is in the IE browser (not in the our libraries)

Thank you.


Hi Pavel,


I tried your suggestion but it seem to only work for the resultant filename.

I also want to be able to control the location of the source and target files so I can also manage it.

I was hoping to have something like this:

[Storage Location]/[Date-Time]/Source[Some unique value].docx
[Storage Location]/[Date-Time]/Target[Some unique value].docx
[Storage Location]/[Date-Time]/Resultfile[Some unique value].docx

[Storage Location]/temp/Cache/[Date-Time]/Resultfile[Some unique value].docx/

[Storage Location]/temp/Processing/[Date-Time]/Resultfile[Some unique value].docx/

This way, I can easily cleanup all files by date.

This could not exactly be this way, but some pattern that I can use to make the file management easier.

Thanks.

Leo



Hello Leo,


Thank you for additional information. You can store the source and target files in any folder you want inside the [storage location] and then compare them in such way . The only thing that you should change in my suggestion from the previous post is move folder creation to the functional which uploads source and target files. Or you can share with me the use case of where from you get these documents and I will help you with how to prepare them for comparing and store them in a proper location.

Thank you.