Java File Path Delete deleteDataFiles(final Collection paths)

Here you can find the source of deleteDataFiles(final Collection paths)

Description

Delete all files from collection of paths in String format.

License

Open Source License

Parameter

Parameter Description
paths a parameter

Exception

Parameter Description

Declaration

public static void deleteDataFiles(final Collection<String> paths) throws IOException 

Method Source Code

//package com.java2s;

import java.io.File;

import java.io.IOException;

import java.util.Collection;

public class Main {
    /**/*from w w w .j  a v  a  2  s.c o m*/
     * Delete all files from collection of paths in String format.
     * @param paths 
     * @throws java.io.IOException 
     */
    public static void deleteDataFiles(final Collection<String> paths) throws IOException {

        for (String path : paths) {

            File file = new File(path);
            if (file.exists()) {
                file.delete();
            } else {
                throw new IOException("Failed to delete folowing data file :\n" + file.getPath());
            }
        }
    }
}

Related

  1. deleteAndCreateFolder(String path)
  2. deleteBlankPath(String path)
  3. deleteChildDirectoriesExcept(File path, String... directoriesToSkip)
  4. deleteContents(File dirPath, List failures)
  5. deleteContentsOnly(final String srcPath)
  6. deleteDb(String path)
  7. deleteDir(File delDir)
  8. deleteDir(File dir)
  9. deleteDir(File dir)