List files by extension - empty directory
Created: 2010-10-28 15:17:35
The create_temporary_directory beanshell creates a temporary directory and outputs the path to that directory.
The empty directory is examined by the List_files_by_extension service. Since no files end in ".png", an empty list is output.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
List files by extension - empty directory |
List files by extension - empty directory |
List files by extension - empty directory |
Descriptions (1)
The create_temporary_directory beanshell creates a temporary directory and outputs the path to that directory.
The empty directory is examined by the List_files_by_extension service. Since no files end in ".png", an empty list is output. |
Dependencies (0)
Processors (3)
Name |
Type |
Description |
List_Files_By_Extension |
localworker |
Scriptclass FileExtFilter implements FileFilter {
public FileExtFilter(String ext) {
this.ext = ext;
}
public boolean accept(File file) {
return file.getName().endsWith(ext);
}
String ext = null;
}
if (extension == void || extension.equals("")) {
throw new RuntimeException(
"The 'extension' parameter cannot be null. Please enter a valid file extension.");
}
if (directory == void || directory.equals("")) {
throw new RuntimeException(
"The 'directory' parameter cannot be null. Please enter a valid file directory.");
}
File dirObj = new File(directory);
if (!dirObj.exists()) {
throw new RuntimeException("The 'directory' parameter specified:" + directory
+ "does not exist. Please enter a valid file directory.");
}
File[] fileObjList = dirObj.listFiles(new FileExtFilter(extension));
List filelist = new ArrayList();
for (int i = 0; i < fileObjList.length; i++) {
filelist.add(fileObjList[i].getAbsolutePath());
}
|
create_temporary_directory |
beanshell |
ScriptFile temp = File.createTempFile("taverna", ".dir");
temp.delete();
temp.mkdir();
temp.deleteOnExit();
directoryPath = temp.getCanonicalPath(); |
png |
stringconstant |
Value.png |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
create_temporary_directory |
|
|
directoryPath
|
Outputs (1)
Name |
Description |
matching_files |
|
Datalinks (3)
Source |
Sink |
create_temporary_directory:directoryPath |
List_Files_By_Extension:directory |
png:value |
List_Files_By_Extension:extension |
List_Files_By_Extension:filelist |
matching_files |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (0)
(People/Groups)
None
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment