I want to move the file downloaded on first click to folder 1 and move the file downloaded on second click to folder 2 using java.
How it can be achieved using Java. Can somebody help me ?
for (WebElement element:list)
{
element.click();
String sourcePath = "C:\\Users\\sh370472\\Downloads";
String destPath = "E:\\Query\\";
String extension = ".csv";
try
{
File[] files = moveFile.getTheFilesWithExtension(sourcePath, extension);
for (File file : files)
{
moveFile.moveFile(file.getPath(),destPath+file.getName());
}
}
catch (IOException e) {
e.printStackTrace();
}
I want to check if it's a first or second download on the file(check image for ref). If it's a first click then the file should be moved first folder and If it's a second click then the file should be second folder