4

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148

1 Answers1

9

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.

notnoop
  • 58,763
  • 21
  • 123
  • 144