1
votes

All,

I have a simple java code to let me copy paste file from one folder to another for a weekly backup. This code works fine however my problem is i want to compress the file while saving. the size of the (.nsf lotus notes database file) is almost 1.5 gb and I plan to run a weekly backup. I tried using the zip package available in java but it does not compress the size is still the same.

Can anyone please give me some usefull tip or guidance on how to compress a .nsf lotus notes database file using java?

public static void main(String[] args) 
{
    System.out.println("Copy Paste Process Started ");

    DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
    Date date = new Date();
    String reportDate = dateFormat.format(date);
    System.out.println(reportDate);

    File f1= new File("C:\\notes\\data\\people\\xyz.nsf");
    File f2= new File("E:\\Backup\\xyz"+reportDate+".nsf");
    FileUtils.copyFile(f1, f2);

    System.out.println("Done");

}
1
If you manually compress the file using eg WinZip or WinRAR, does it actually become smaller? Not familiar with nsf files, but it's always possible that they are some precompressed format. - fvu
This suggests the data file is already compressed, or possibly encrypted. Can you significantly compress the file with an external utility? - Jongware
Thank you for your reply guys i just had to make few changes in the notes database setting to allow it to be compressed, it now works. - Marsh

1 Answers

4
votes

Set database's property to Do not locally encrypt this database. You can find this property in Encryption Settings....

After setting the property you have to Compact your database (second tab of database's properties). Then, the size of your database should get reduced significantly using java zip package.

You have to set this properties only once.