I'm working on a java application that create and store invoice in pdf. I create a new folder for every new year an every new month I stored it as follow:
private void CreateDir () {
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
String yearInString = String.valueOf(year);
int month = now.get(Calendar.MONTH) +1;
String monthInYear = String.valueOf(month);
File rootDir = File.listRoots()[0];
File dir = new File(new File(new File(rootDir, "MijnFacturen"), yearInString), monthInYear);
if (!dir.exists()){
dir.mkdirs();
System.out.println("directories made");
setInvoicePath(dir.toString());
System.out.println(invoicePath);
} else {
setInvoicePath(dir.toString());
System.out.println(invoicePath);
}
}
So for so good. But when i save the path to mysql database it automatically removes the backslashes from my string. I read that it was a bad practical to save paths in a database. But where should i save my pathfile then. And whats the best way to retrieve it ??