Q:

How to get autogenerated folder path in java to parse files from a folder

In Unix created a folder path like /data/test/files/2015/05/19. From year, folder is autogenerated /data/test/files/$(date +%Y)/$(date +%m)/$(date +%d)
So .txt file inside the above folder location should be parsed through Java code and moved to DB.
I tried to parse that location as 2015/05/19 will change in future, so tried to append current year/month/day in Java and then parse that particular file.             
//To get current year
String thisYear = new SimpleDateFormat("yyyy").format(new Date());
System.out.println("thisYear :"+thisYear);
//To get current month
String thisMonth = new SimpleDateFormat("MM").format(new Date());
System.out.println("thisMonth : "+thisMonth);

//To get current date
String thisDay = new SimpleDateFormat("dd").format(new Date());
System.out.println("thisDay : "+thisDay);

File f = new File("\\data\\test\\files\\+"thisYear"+\\+"thisMonth"+\\+"thisDay"+ \\refile.txt");

The above didn't work so how can I use thisYear,thisMonth,thisDay in path? 

A:

Try this. I think this works.
File f = new File("/data/test/files/" + thisYear+ "/" + thisMonth+ "/" +thisDay + "/refile.txt");

