Question

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?

Was it helpful?

Solution

If you mean checking FileObject, then you can use [FileObject.getType()](http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/FileObject.html#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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top