rm Dir shell command - Java Native OS

Java examples for Native OS:Shell Command

Description

rm Dir shell command

Demo Code


//package com.java2s;

import java.io.File;

public class Main {
    public static void rmDir(String dirPath) {
        File mtpDir = new File(dirPath);
        for (File file : mtpDir.listFiles()) {
            System.out.println("Deleting " + file.getName());
            file.delete();/*  w  ww. j a v a 2s  . c  om*/
        }
    }
}

Related Tutorials