I have a method which takes in the parameters such as hostName, userName.
I create a fileName by adding the recent time to it.
I want to create a file in the system, which includes the format /hostName/userName/fileName so that the user who logs in, creates a file in their own directory with their own credentials, the user directory contains their domain and username. Inside the directory /hostName/userName is a file with the name fileName. EG:
User1: /windows/user1/201512110309.txt
User2: /ubuntu/user2/201512111210.txt
public File getDirectoryAndFileName(String hostName, String userName) {
String fileName = new SimpleDateFormat("yyyyMMddhhmm'.txt'").format(new Date());
File file = new File(hostName + userName + fileName);
return file;
}