List files by regex - empty directory
Created: 2010-10-28 15:29:22
Last updated: 2010-10-28 15:29:23
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_regex service. Since there are no files, an empty list is output.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
List files by regex - empty directory |
List files by regex - empty directory
|
List files by regex - 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_regex service. Since there are no files, an empty list is output. |
Dependencies (0)
Processors (3)
Name |
Type |
Description |
create_temporary_directory |
beanshell |
ScriptFile temp = File.createTempFile("taverna", ".dir");
temp.delete();
temp.mkdir();
temp.deleteOnExit();
directoryPath = temp.getCanonicalPath(); |
List_Files_By_Regex |
localworker |
Scriptclass FileRegexFilter implements FileFilter {
public FileRegexFilter(String regex) {
this.regex = regex;
}
public boolean accept(File file) {
return file.getName().matches(regex);
}
String regex = null;
}
if (regex == void || regex.equals("")) {
throw new RuntimeException(
"The 'regex' 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 FileRegexFilter(regex));
List filelist = new ArrayList();
for (int i = 0; i < fileObjList.length; i++) {
filelist.add(fileObjList[i].getAbsolutePath());
}
|
strings_containing_c |
stringconstant |
Value.*c.* |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
create_temporary_directory |
|
|
directoryPath
|
Outputs (1)
Name |
Description |
matching_files |
|
Datalinks (3)
Source |
Sink |
strings_containing_c:value |
List_Files_By_Regex:regex |
create_temporary_directory:directoryPath |
List_Files_By_Regex:directory |
List_Files_By_Regex: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