public static String generateLogPath(String dir)
    {
	try
	{
	    System.out.println(dir);
	    String root = dir + File.separatorChar + "Logs"+File.separatorChar;
	    String FolderName = getDateWithSeperator("_");
	    String parentFolder = root + FolderName;
	    System.out.println(parentFolder);
	    if(!dirExist(parentFolder))
		dirCreateRecursive(parentFolder);

	    if (!dirExist(parentFolder))
	    {
		String TestFolder = parentFolder + File.separatorChar+"Test_1_" + getCondensedTime();
		return TestFolder;
	    }
	    else
	    {
		File[] Directories = getDirectories(parentFolder);

		if (Directories != null)
		{
		    if (Directories.length > 0)
		    {
			int currentTestNumber = 0;

			for(File d : Directories)
			{
			    String dName = d.getName();

			    String TEMP1 = dName.replace("Test_", "");
			    int IndexOfFirstUnderscore = TEMP1.indexOf('_');

			    int candidateTestNumber = Integer.parseInt(TEMP1.substring(0, IndexOfFirstUnderscore));

			    if (candidateTestNumber > currentTestNumber)
			    {
				currentTestNumber = candidateTestNumber;
			    }
			}

			currentTestNumber++;

			String TestFolder = parentFolder + File.separatorChar+ "Test_"+currentTestNumber+"_" + getCondensedTime();

			return TestFolder;
		    }
		    else
		    {
			String TestFolder = parentFolder + File.separatorChar +"Test_1_" + getCondensedTime();
			return TestFolder;
		    }
		}
		else 
		{
		    String TestFolder = parentFolder + File.separatorChar+"Test_1_" + getCondensedTime();
		    return TestFolder;
		}
	    }
	}
	catch(Exception e){return null;}
    }