Example usage for org.apache.commons.vfs2 FileObject delete

List of usage examples for org.apache.commons.vfs2 FileObject delete

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileObject delete.

Prototype

int delete(FileSelector selector) throws FileSystemException;

Source Link

Document

Deletes all descendants of this file that match a selector.

Usage

From source file:tw.edu.sinica.iis.SSHadoop.SSHSftp.java

public void sftpDelete(final String remoteDir) {
    try {/* www. j  a  v a 2s . c om*/
        manager.init();

        FileObject remote = manager.resolveFile(genConnectString() + remoteDir, opts.getOptions());

        if (remote.exists()) {
            remote.delete(Selectors.SELECT_ALL);
        }

    } catch (FileSystemException e) {
        e.printStackTrace();
    } finally {
        manager.close();
    }
}