public static void initEndpointDirectory(MuleContext muleContext, String endpointName) throws MuleException, IOException, SftpException {
		SftpClient sftpClient = getSftpClient(muleContext, endpointName);
		try {
			ChannelSftp channelSftp = sftpClient.getChannelSftp();
			try {
				recursiveDelete(muleContext, sftpClient, endpointName, "");
			} catch (IOException e) {
				if (logger.isErrorEnabled())
					logger.error("Failed to recursivly delete endpoint " + endpointName, e);
			}

			String path = getPathByEndpoint(muleContext, sftpClient, endpointName);
			mkDirs(channelSftp, path);
		} finally {
			sftpClient.disconnect();
			if (logger.isDebugEnabled())
				logger.debug("Done init endpoint directory: " + endpointName);
		}
	}
public static void initEndpointDirectory ( MuleContext muleContext , String endpointName ) throws MuleException , IOException , SftpException { SftpClient sftpClient = getSftpClient ( muleContext , endpointName ) ; try { ChannelSftp channelSftp = sftpClient . getChannelSftp ( ) ; try { recursiveDelete ( muleContext , sftpClient , endpointName , "" ) ; } catch ( IOException e ) { if ( logger . isErrorEnabled ( ) ) logger . error ( "Failed to recursivly delete endpoint " + endpointName , e ) ; } String path = getPathByEndpoint ( muleContext , sftpClient , endpointName ) ; mkDirs ( channelSftp , path ) ; } finally { sftpClient . disconnect ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Done init endpoint directory: " + endpointName ) ; } }
Ensures that the directory exists and is writable by deleting the
directory and then recreate it.

@param muleContext
@param endpointName
@throws org.mule.api.MuleException
@throws java.io.IOException
@throws com.jcraft.jsch.SftpException