0

How do I make it so that certain files move to a certain directory and log it as failed? The files are saved locally and I would like to move them around locally too. What are the commands or statements in java to achieve this?

3 Answers3

0

Have a look at the Javadoc for Files. It has move methods which throw exceptions on failure.

fge
  • 119,121
  • 33
  • 254
  • 329
0

I suggest that you look specifically at the following Javadoc. The reason why I say that is because Java 7 (within the java.nio.* package) provides new File I/O APIs that are much more versatile than previous Java versions.

blackpanther
  • 10,998
  • 11
  • 48
  • 78
0

See https://stackoverflow.com/a/115086/4850

As for errors, in the try/finally block of the second answer of the above link, code a catch block which does the logging.

Community
  • 1
  • 1
André Chalella
  • 13,788
  • 10
  • 54
  • 62