Java Code Examples for org.apache.commons.vfs2.FileSelectInfo

The following examples show how to use org.apache.commons.vfs2.FileSelectInfo. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hop   Source File: Mail.java    License: Apache License 2.0 6 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( sourceFolder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() )
        || ( ( !info.getFile().getParent().equals( info.getBaseFolder() ) && meta.isIncludeSubFolders() ) ) ) {
        if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null )
          || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard(
          short_filename, fileWildcard ) ) ) {
          returncode = true;
        }
      }
    }
  } catch ( Exception e ) {
    logError( BaseMessages.getString( PKG, "Mail.Error.FindingFiles", info.getFile().toString(), e
      .getMessage() ) );
    returncode = false;
  }
  return returncode;
}
 
Example 2
Source Project: pentaho-kettle   Source File: JobEntryAddResultFilenames.java    License: Apache License 2.0 6 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( sourceFolder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() )
        || ( !info.getFile().getParent().equals( info.getBaseFolder() ) && includeSubfolders ) ) {
        if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null )
          || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard(
            short_filename, fileWildcard ) ) ) {
          returncode = true;
        }
      }
    }
  } catch ( Exception e ) {
    logError( "Error while finding files ... in ["
      + info.getFile().toString() + "]. Exception :" + e.getMessage() );
    returncode = false;
  }
  return returncode;
}
 
Example 3
Source Project: hop   Source File: ActionAddResultFilenames.java    License: Apache License 2.0 6 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( sourceFolder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() )
        || ( !info.getFile().getParent().equals( info.getBaseFolder() ) && includeSubfolders ) ) {
        if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null )
          || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard(
          short_filename, fileWildcard ) ) ) {
          returncode = true;
        }
      }
    }
  } catch ( Exception e ) {
    logError( "Error while finding files ... in ["
      + info.getFile().toString() + "]. Exception :" + e.getMessage() );
    returncode = false;
  }
  return returncode;
}
 
Example 4
Source Project: pentaho-kettle   Source File: Mail.java    License: Apache License 2.0 6 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( sourceFolder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() )
        || ( ( !info.getFile().getParent().equals( info.getBaseFolder() ) && meta.isIncludeSubFolders() ) ) ) {
        if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null )
          || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard(
            short_filename, fileWildcard ) ) ) {
          returncode = true;
        }
      }
    }
  } catch ( Exception e ) {
    logError( BaseMessages.getString( PKG, "Mail.Error.FindingFiles", info.getFile().toString(), e
      .getMessage() ) );
    returncode = false;
  }
  return returncode;
}
 
Example 5
Source Project: commons-vfs   Source File: CanWriteFileFilter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Checks to see if the file can be written to.
 *
 * @param fileInfo the File to check
 *
 * @return {@code true} if the file can be written to, otherwise {@code false}.
 * @throws FileSystemException Thrown for file system errors.
 */
@Override
public boolean accept(final FileSelectInfo fileInfo) throws FileSystemException {
    try (final FileObject file = fileInfo.getFile()) {
        final FileSystem fileSystem = file.getFileSystem();
        if (file.exists()) {
            if (!fileSystem.hasCapability(Capability.WRITE_CONTENT)) {
                return false;
            }
            return file.isWriteable();
        }
        if (!fileSystem.hasCapability(Capability.CREATE)) {
            return false;
        }
        return file.getParent().isWriteable();
    }
}
 
Example 6
Source Project: commons-vfs   Source File: EmptyFileFilter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Checks to see if the file is empty. A non-existing file is also considered empty.
 *
 * @param fileInfo the file or directory to check
 *
 * @return {@code true} if the file or directory is <i>empty</i>, otherwise {@code false}.
 * @throws FileSystemException Thrown for file system errors.
 */
@Override
public boolean accept(final FileSelectInfo fileInfo) throws FileSystemException {
    try (final FileObject file = fileInfo.getFile()) {
        if (!file.exists()) {
            return true;
        }
        if (file.getType() == FileType.FOLDER) {
            final FileObject[] files = file.getChildren();
            return files == null || files.length == 0;
        }
        try (final FileContent content = file.getContent();) {
            return content.isEmpty();
        }
    }
}
 
Example 7
Source Project: commons-vfs   Source File: VerifyingFileSelector.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Determines if a file or folder should be selected.
 */
@Override
public boolean includeFile(final FileSelectInfo fileInfo) throws FileSystemException {
    final FileObject file = fileInfo.getFile();
    if (file == currentFolder) {
        // Pop current folder
        assertEquals(0, children.size());
        currentFolder = currentFolder.getParent();
        currentFolderInfo = currentFolderInfo.getParent();
        children = stack.remove(0);
    }

    final String baseName = file.getName().getBaseName();

    final FileInfo childInfo = getChild(baseName);
    assertSame(childInfo.type, file.getType());

    final boolean isChild = children.remove(baseName);
    assertTrue(isChild);

    files.add(file);
    return true;
}
 
Example 8
Source Project: commons-vfs   Source File: OrFileFilterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAccept() throws FileSystemException {

    final FileSelectInfo any = createFileSelectInfo(new File("anyfile"));

    // Empty
    Assert.assertFalse(new OrFileFilter().accept(any));

    // True
    Assert.assertTrue(new OrFileFilter(new True()).accept(any));
    Assert.assertTrue(new OrFileFilter(new True(), new True()).accept(any));
    Assert.assertTrue(new OrFileFilter(new False(), new True()).accept(any));
    Assert.assertTrue(new OrFileFilter(new True(), new False()).accept(any));

    // False
    Assert.assertFalse(new OrFileFilter(new False()).accept(any));
    Assert.assertFalse(new OrFileFilter(new False(), new False()).accept(any));

}
 
Example 9
Source Project: hop   Source File: ActionFoldersCompare.java    License: Apache License 2.0 5 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( source_folder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() ) ) {
        // In the Base Folder...
        if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) )
          || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) )
          || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) )
          || ( compareonly.equals( "all" ) ) ) {
          returncode = true;
        }
      } else {
        // Not in the Base Folder...Only if include sub folders
        if ( includesubfolders ) {
          if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) )
            || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) )
            || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) )
            || ( compareonly.equals( "all" ) ) ) {
            returncode = true;
          }
        }
      }

    }
  } catch ( Exception e ) {

    logError( "Error while finding files ... in ["
      + info.getFile().toString() + "]. Exception :" + e.getMessage() );
    returncode = false;
  }
  return returncode;
}
 
Example 10
Source Project: pentaho-kettle   Source File: JobEntryDeleteFiles.java    License: Apache License 2.0 5 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean doReturnCode = false;
  try {

    if ( !info.getFile().toString().equals( sourceFolder ) && !parentjob.isStopped() ) {
      // Pass over the Base folder itself
      String shortFilename = info.getFile().getName().getBaseName();

      if ( !info.getFile().getParent().equals( info.getBaseFolder() ) ) {
        // Not in the Base Folder..Only if include sub folders
        if ( includeSubfolders
          && ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( shortFilename, fileWildcard ) ) {
          if ( log.isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "JobEntryDeleteFiles.DeletingFile", info
              .getFile().toString() ) );
          }
          doReturnCode = true;
        }
      } else {
        // In the Base Folder...
        if ( ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( shortFilename, fileWildcard ) ) {
          if ( log.isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "JobEntryDeleteFiles.DeletingFile", info
              .getFile().toString() ) );
          }
          doReturnCode = true;
        }
      }
    }
  } catch ( Exception e ) {
    log.logError(
      BaseMessages.getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcessError" ), BaseMessages
        .getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcess", info.getFile().toString(), e
          .getMessage() ) );

    doReturnCode = false;
  }

  return doReturnCode;
}
 
Example 11
Source Project: hop   Source File: ActionDeleteFiles.java    License: Apache License 2.0 5 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean doReturnCode = false;
  try {

    if ( !info.getFile().toString().equals( sourceFolder ) && !parentjob.isStopped() ) {
      // Pass over the Base folder itself
      String shortFilename = info.getFile().getName().getBaseName();

      if ( !info.getFile().getParent().equals( info.getBaseFolder() ) ) {
        // Not in the Base Folder..Only if include sub folders
        if ( includeSubfolders
          && ( info.getFile().getType() == FileType.FILE ) && getFileWildcard( shortFilename, fileWildcard ) ) {
          if ( log.isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "ActionDeleteFiles.DeletingFile", info
              .getFile().toString() ) );
          }
          doReturnCode = true;
        }
      } else {
        // In the Base Folder...
        if ( ( info.getFile().getType() == FileType.FILE ) && getFileWildcard( shortFilename, fileWildcard ) ) {
          if ( log.isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "ActionDeleteFiles.DeletingFile", info
              .getFile().toString() ) );
          }
          doReturnCode = true;
        }
      }
    }
  } catch ( Exception e ) {
    log.logError(
      BaseMessages.getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcessError" ), BaseMessages
        .getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcess", info.getFile().toString(), e
          .getMessage() ) );

    doReturnCode = false;
  }

  return doReturnCode;
}
 
Example 12
@Before
public void init() throws FileSystemException {
  fileSelectInfoMock = Mockito.mock( FileSelectInfo.class );
  fileSelector = new ActionZipFile
    .ZipJobEntryPatternFileSelector( Pattern.compile( PATTERN ), Pattern.compile( EXCLUDE_PATTERN ) );
  fileObjectMock = Mockito.mock( FileObject.class );
  fileNameMock = Mockito.mock( FileName.class );

  Mockito.when( fileSelectInfoMock.getFile() ).thenReturn( fileObjectMock );
  Mockito.when( fileObjectMock.getType() ).thenReturn( FileType.FILE );
  Mockito.when( fileObjectMock.getName() ).thenReturn( fileNameMock );
  Mockito.when( fileNameMock.getBaseName() ).thenReturn( PATTERN_FILE_NAME );

}
 
Example 13
Source Project: obevo   Source File: BasicFileSelector.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception {
    if (fileInfo.getFile().getType() == FileType.FOLDER && fileInfo.getDepth() == 0) {
        return true;
    } else if (this.directoryFilter != null) {
        return this.directoryFilter.accept(fileInfo);
    } else {
        return this.traverseDescendents;
    }
}
 
Example 14
Source Project: obevo   Source File: DirectoryFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(FileSelectInfo fileInfo) {
    try {
        return fileInfo.getFile().getType() == FileType.FOLDER;
    } catch (FileSystemException e) {
        throw new RuntimeException(e);
    }
}
 
Example 15
Source Project: obevo   Source File: OrFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(FileSelectInfo fileInfo) {
    for (FileFilter f : this.filters) {
        if (f.accept(fileInfo)) {
            return true;
        }
    }
    return false;
}
 
Example 16
Source Project: datacollector   Source File: FileFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
  if (fileInfo.getFile().getType() == FileType.FILE) {
    Matcher matcher = regex.matcher(fileInfo.getFile().getName().getBaseName());
    if (matcher.matches()) {
      return true;
    }
  }
  LOG.trace("{} was not included", fileInfo.getFile().getName().getPath());
  return false;
}
 
Example 17
Source Project: datacollector   Source File: TestFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
private FileSelectInfo createFileSelectInfo(String fileName, boolean isFile) throws Exception {
  FileSelectInfo fileSelectInfo = Mockito.mock(FileSelectInfo.class);
  FileObject fileObject = Mockito.mock(FileObject.class);
  Mockito.when(fileSelectInfo.getFile()).thenReturn(fileObject);
  if (isFile) {
    Mockito.when(fileObject.getType()).thenReturn(FileType.FILE);
  } else {
    Mockito.when(fileObject.getType()).thenReturn(FileType.FOLDER);
  }
  FileName fName = Mockito.mock(FileName.class);
  Mockito.when(fileObject.getName()).thenReturn(fName);
  Mockito.when(fName.getBaseName()).thenReturn(fileName);
  return fileSelectInfo;
}
 
Example 18
@Override
public boolean includeFile( FileSelectInfo fileSelectInfo ) throws Exception {
  if ( fileSelectInfo.getFile().equals( fileSelectInfo.getBaseFolder() ) ) {
    // Do not consider the base folders
    return false;
  }
  // Determine relative name to compare
  int baseNameLength = fileSelectInfo.getBaseFolder().getName().getPath().length() + 1;
  String relativeName = fileSelectInfo.getFile().getName().getPath().substring( baseNameLength );
  // Compare plugin folder name with the relative name
  return pluginFolderName.equals( relativeName );
}
 
Example 19
Source Project: commons-vfs   Source File: AndFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(final FileSelectInfo fileInfo) throws FileSystemException {
    if (this.fileFilters.isEmpty()) {
        return false;
    }
    for (final FileFilter fileFilter : fileFilters) {
        if (!fileFilter.accept(fileInfo)) {
            return false;
        }
    }
    return true;
}
 
Example 20
Source Project: commons-vfs   Source File: OrFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean accept(final FileSelectInfo fileInfo) throws FileSystemException {
    for (final FileFilter fileFilter : fileFilters) {
        if (fileFilter.accept(fileInfo)) {
            return true;
        }
    }
    return false;
}
 
Example 21
Source Project: commons-vfs   Source File: PrefixFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Checks to see if the file name starts with the prefix.
 *
 * @param fileInfo the File to check
 *
 * @return true if the file name starts with one of our prefixes
 */
@Override
public boolean accept(final FileSelectInfo fileInfo) {
    final String name = fileInfo.getFile().getName().getBaseName();
    for (final String prefix : this.prefixes) {
        if (caseSensitivity.checkStartsWith(name, prefix)) {
            return true;
        }
    }
    return false;
}
 
Example 22
Source Project: commons-vfs   Source File: WildcardFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Checks to see if the file name matches one of the wildcards.
 *
 * @param fileInfo the file to check
 *
 * @return true if the file name matches one of the wildcards
 */
@Override
public boolean accept(final FileSelectInfo fileInfo) {
    final String name = fileInfo.getFile().getName().getBaseName();
    for (final String wildcard : wildcards) {
        if (wildcardMatch(name, wildcard, caseSensitivity)) {
            return true;
        }
    }
    return false;
}
 
Example 23
Source Project: commons-vfs   Source File: SuffixFileFilter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Checks to see if the file name ends with the suffix.
 *
 * @param fileInfo the File to check
 *
 * @return true if the file name ends with one of our suffixes
 */
@Override
public boolean accept(final FileSelectInfo fileInfo) {
    final String name = fileInfo.getFile().getName().getBaseName();
    for (final String suffix : this.suffixes) {
        if (caseSensitivity.checkEndsWith(name, suffix)) {
            return true;
        }
    }
    return false;
}
 
Example 24
@Before
public void init() throws FileSystemException {
  fileSelectInfoMock = Mockito.mock( FileSelectInfo.class );
  fileSelector = new JobEntryZipFile
    .ZipJobEntryPatternFileSelector( Pattern.compile( PATTERN ), Pattern.compile( EXCLUDE_PATTERN ) );
  fileObjectMock = Mockito.mock( FileObject.class );
  fileNameMock = Mockito.mock( FileName.class );

  Mockito.when( fileSelectInfoMock.getFile() ).thenReturn( fileObjectMock );
  Mockito.when( fileObjectMock.getType() ).thenReturn( FileType.FILE );
  Mockito.when( fileObjectMock.getName() ).thenReturn( fileNameMock );
  Mockito.when( fileNameMock.getBaseName() ).thenReturn( PATTERN_FILE_NAME );

}
 
Example 25
Source Project: spoofax   Source File: LanguageFileScanSelector.java    License: Apache License 2.0 5 votes vote down vote up
@Override public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
    final FileObject file = fileInfo.getFile();
    if(isLanguageSpecDirectory(file)) {
        return true;
    }
    return file.getName().getExtension().equals("spoofax-language");
}
 
Example 26
Source Project: pentaho-kettle   Source File: JobEntryFoldersCompare.java    License: Apache License 2.0 5 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {
    if ( !info.getFile().toString().equals( source_folder ) ) {
      // Pass over the Base folder itself
      String short_filename = info.getFile().getName().getBaseName();

      if ( info.getFile().getParent().equals( info.getBaseFolder() ) ) {
        // In the Base Folder...
        if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) )
          || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) )
          || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) )
          || ( compareonly.equals( "all" ) ) ) {
          returncode = true;
        }
      } else {
        // Not in the Base Folder...Only if include sub folders
        if ( includesubfolders ) {
          if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) )
            || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) )
            || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) )
            || ( compareonly.equals( "all" ) ) ) {
            returncode = true;
          }
        }
      }

    }
  } catch ( Exception e ) {

    logError( "Error while finding files ... in ["
      + info.getFile().toString() + "]. Exception :" + e.getMessage() );
    returncode = false;
  }
  return returncode;
}
 
Example 27
Source Project: pentaho-kettle   Source File: JobEntryCheckFilesLocked.java    License: Apache License 2.0 5 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) {
  boolean returncode = false;
  try {

    if ( !info.getFile().toString().equals( sourceFolder ) ) {
      // Pass over the Base folder itself

      String shortFilename = info.getFile().getName().getBaseName();

      if ( !info.getFile().getParent().equals( info.getBaseFolder() ) ) {
        // Not in the Base Folder..Only if include sub folders
        if ( includeSubfolders ) {
          returncode = includeFileCheck( info, shortFilename );
        }
      } else {
        // In the Base Folder...
        returncode = includeFileCheck( info, shortFilename );
      }
    }

  } catch ( Exception e ) {
    logError( BaseMessages.getString( PKG, "JobCheckFilesLocked.Error.Exception.ProcessError" ), BaseMessages
      .getString( PKG, "JobCheckFilesLocked.Error.Exception.Process", info.getFile().toString(), e
        .getMessage() ) );
  }

  return returncode;
}
 
Example 28
Source Project: hop   Source File: ProcessFiles.java    License: Apache License 2.0 4 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) throws Exception {
  return true;
}
 
Example 29
Source Project: hop   Source File: ProcessFiles.java    License: Apache License 2.0 4 votes vote down vote up
public boolean traverseDescendents( FileSelectInfo info ) {
  return false;
}
 
Example 30
Source Project: hop   Source File: ActionFolderIsEmpty.java    License: Apache License 2.0 4 votes vote down vote up
public boolean includeFile( FileSelectInfo info ) throws ExpectedException {
  boolean returncode = false;
  FileObject file_name = null;
  boolean rethrow = false;
  try {
    if ( !info.getFile().toString().equals( root_folder ) ) {
      // Pass over the Base folder itself
      if ( ( info.getFile().getType() == FileType.FILE ) ) {
        if ( info.getFile().getParent().equals( info.getBaseFolder() ) ) {
          // We are in the Base folder
          if ( ( isSpecifyWildcard() && GetFileWildcard( info.getFile().getName().getBaseName() ) )
            || !isSpecifyWildcard() ) {
            if ( log.isDetailed() ) {
              log.logDetailed( "We found file : " + info.getFile().toString() );
            }
            filescount++;
          }
        } else {
          // We are not in the base Folder...ONLY if Use sub folders
          // We are in the Base folder
          if ( isIncludeSubFolders() ) {
            if ( ( isSpecifyWildcard() && GetFileWildcard( info.getFile().getName().getBaseName() ) )
              || !isSpecifyWildcard() ) {
              if ( log.isDetailed() ) {
                log.logDetailed( "We found file : " + info.getFile().toString() );
              }
              filescount++;
            }
          }
        }
      } else {
        folderscount++;
      }
    }
    if ( filescount > 0 ) {
      rethrow = true;
      throw new ExpectedException();
    }
    return true;

  } catch ( Exception e ) {
    if ( !rethrow ) {
      log.logError( BaseMessages.getString( PKG, "JobFolderIsEmpty.Error" ), BaseMessages.getString(
        PKG, "JobFolderIsEmpty.Error.Exception", info.getFile().toString(), e.getMessage() ) );
      returncode = false;
    } else {
      throw (ExpectedException) e;
    }
  } finally {
    if ( file_name != null ) {
      try {
        file_name.close();
        file_name = null;
      } catch ( IOException ex ) { /* Ignore */
      }
    }
  }
  return returncode;
}