Selenium Java: Detecting if a file has been generated and moving a file from one directory to another : For Selenium with Java, I have a test case scenario that involves many steps amongst which:

A- Checking whether a certain file has been generated in a certain directory.
B- moving this file from this directory to another specific directory.

How can A & B be implemented ?