Execute cmd line app - unix - /bin/ls -R of temporary directory
Created: 2010-10-28 14:50:13
Last updated: 2010-10-28 14:50:58
Note that this workflow only works on Unix systems. The get_temporary_directory beanshell returns the path to the directory in which temporary files are held. This value is passed to the create_and_populate_list beanshell which creates a list of '-R' and the path. The resultant list is passed to the args port of the Execute_cmd_line_app service. The command port of that service has been defaulted to '/bin/ls'. The execute_cmd_line_app service runs the /bin/ls -R command on the temporary directory. The result is passed to its result port and then to the output port of the workflow.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
Execute cmd line app - unix - /bin/ls -R of temporary directory |
Execute cmd line app - unix - /bin/ls -R of temporary directory |
Execute cmd line app - unix - /bin/ls -R of temporary directory |
Descriptions (2)
Note that this workflow only works on Unix systems.
The get_temporary_directory beanshell returns the path to the directory in which temporary files are held. This value is passed to the create_and_populate_list beanshell which creates a list of '-R' and the path. The resultant list is passed to the args port of the Execute_cmd_line_app service. The command port of that service has been defaulted to '/bin/ls'.
The execute_cmd_line_app service runs the /bin/ls -R command on the temporary directory. The result is passed to its result port and then to the out port of the workflow. |
Note that this workflow only works on Unix systems.
The get_temporary_directory beanshell returns the path to the directory in which temporary files are held. This value is passed to the create_and_populate_list beanshell which creates a list of '-R' and the path. The resultant list is passed to the args port of the Execute_cmd_line_app service. The command port of that service has been defaulted to '/bin/ls'.
The execute_cmd_line_app service runs the /bin/ls -R command on the temporary directory. The result is passed to its result port and then to the output port of the workflow. |
Dependencies (0)
Processors (5)
Name |
Type |
Description |
Get_temporary_directory |
beanshell |
ScriptFile f = File.createTempFile("taverna", ".tmp");
directoryPath = f.getParent(); |
Create_and_populate_list |
beanshell |
ScriptList outList = new ArrayList();
outList.add(in1);
outList.add(in2); |
recursive |
stringconstant |
Value-R |
ls_command |
stringconstant |
Value/bin/ls |
Execute_Command_Line_App |
localworker |
Scriptif (command == void || command.equals("")) {
throw new RuntimeException("The 'command' port cannot be null.");
}
Process proc = null;
Runtime rt = Runtime.getRuntime();
String osName = System.getProperty("os.name");
String[] cmdArray = null;
if (osName.equals("Windows NT") || osName.equals("Windows XP")) {
cmdArray = new String[] { "cmd.exe", "/c", command };
} else if (osName.equals("Windows 95")) {
cmdArray = new String[] { "command.exe", "/c", command };
} else {// TODO: investigate if this will work in Linux and OSX
cmdArray = new String[] { command };
}
// concatenate the arrays
if ((args == void) || (args == null)) {
args = new ArrayList();
}
int argSize = cmdArray.length + args.size();
ArrayList appArray = new ArrayList(argSize);
for (int i = 0; i < cmdArray.length; i++) {
appArray.add(cmdArray[i]);
}
for (int i = 0; i < args.size(); i++) {
appArray.add(args.get(i));
}
String[] applist = new String[argSize];
appArray.toArray(applist);
proc = rt.exec(applist);
// Get the input stream and read from it
InputStream in = proc.getInputStream();
int c;
StringBuffer sb = new StringBuffer();
while ((c = in.read()) != -1) {
sb.append((char) c);
}
in.close();
result = sb.toString();
|
Beanshells (2)
Name |
Description |
Inputs |
Outputs |
Get_temporary_directory |
|
|
directoryPath
|
Create_and_populate_list |
|
in1
in2
|
outList
|
Datalinks (5)
Source |
Sink |
recursive:value |
Create_and_populate_list:in1 |
Get_temporary_directory:directoryPath |
Create_and_populate_list:in2 |
ls_command:value |
Execute_Command_Line_App:command |
Create_and_populate_list:outList |
Execute_Command_Line_App:args |
Execute_Command_Line_App:result |
result |
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