Class FileHelper

java.lang.Object
com.Ostermiller.util.FileHelper

public class FileHelper extends Object
Utilities for File manipulation. More information about this class is available from ostermiller.org.
Since:
ostermillerutils 1.00.00
Author:
Stephen Ostermiller https://ostermiller.org/contact.pl?regarding=Java+Utilities
  • Constructor Details

    • FileHelper

      public FileHelper()
  • Method Details

    • move

      public static void move(File from, File to) throws IOException
      Move a file from one location to another. An attempt is made to rename the file and if that fails, the file is copied and the old file deleted. If the destination file already exists, an exception will be thrown.
      Parameters:
      from - file which should be moved.
      to - desired destination of the file.
      Throws:
      IOException - if an error occurs.
      Since:
      ostermillerutils 1.00.00
    • move

      public static void move(File from, File to, boolean overwrite) throws IOException
      Move a file from one location to another. An attempt is made to rename the file and if that fails, the file is copied and the old file deleted.
      Parameters:
      from - file which should be moved.
      to - desired destination of the file.
      overwrite - If false, an exception will be thrown rather than overwrite a file.
      Throws:
      IOException - if an error occurs.
      Since:
      ostermillerutils 1.00.00