code: public boolean delete(final String name)
     {
        return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
        {
           public Boolean run()
           {
              File directory = new File(baseDir, name);
              // trivial if it does not exist anymore
              if (!directory.exists())
              {
                 return true;
              }
              // delete files first
              File[] files = directory.listFiles();
              if (files != null)
              {
                 for (int i = 0; i < files.length; i++)
                 {
                    if (!files[i].delete())
                    {
                       return false;
                    }
                 }
              }
              else
              {
                 return false;
              }
              // now delete directory itself
              return directory.delete();
           }
        });
     }
docs: {@inheritDoc}