Java Delete Folder deleteFolderContents(File folder)

Here you can find the source of deleteFolderContents(File folder)

Description

delete Folder Contents

License

Apache License

Declaration

public static void deleteFolderContents(File folder) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    public static void deleteFolderContents(File folder) {
        File[] files = folder.listFiles();
        if (files != null)
            for (File f : files) {
                if (f.isDirectory()) {
                    deleteFolderContents(f);
                    f.delete();//from   w w w .  java  2  s . c om
                } else
                    f.delete();
            }
    }
}

Related

  1. deleteFolder(String folder)
  2. deleteFolder(String folder)
  3. deleteFolder(String name)
  4. deleteFolderContents(File folder)
  5. deleteFolderContents(File folder)
  6. deleteFolderIfEmpty(File f)
  7. deleteFolderRec(File dir)
  8. deleteFolderRecursive(File folder)
  9. deleteFolderRecursively(File file)