views:

199

answers:

1

I'm using Apache Commons VFS (Virtual File System) to access some files over SFTP. Does anybody know how to check if an instance of org.apache.commons.vfs.FileContent is folder?

+1  A: 

If you mean checking FileObject, then you can use FileObject.getType(). Given a non-empty FileContent, you would always assume it's coming from a file. As the specification here says:

There are two types of files: Folders, which contain other files, and normal files, which contain data, or content. A folder may not have any content, and a normal file cannot contain other files.

notnoop
fileObject.getType() == FileType.FOLDER
Boris Pavlović