Thursday, 18 February 2016

How to delete dynamic folder in your application

Hi,

  I want to delete ContactUsList folder in my web-apps. so, it is helpful for that.

String realPath  = ServletContextHolder.servletContext.getRealPath(File.separator+"dataCsv"+File.separator+"ContactUsList");
File c =new File (realPath);
if(c.isDirectory()) {
c.deleteDir()
}

it checks the directory is existed or not in given realPath. if the it is existed then it is deleted.

No comments:

Post a Comment