How to get return from command class ?

Hi Team, I am trying to create a simple workflow (vro 8.4 version) in which the first step is to check if there is a specific folder that exists in vro filesystem(/tmp/folder-xyz) or not  If yes then create a file inside it(/tmp/folder-xyz/file1.txt). I am using the command class for this purpose.

for creating file:



cmd1 = "touch /tmp/folder-xyz/file1.txt"
command = new Command(cmd1)


For directory check


var cmd2 = '[ -d "/tmp/folder-xyz" ] && echo "Directory /tmp/folder-xyz exists."'
command = new Command(cmd2)


The directory check command I want to return the above echo statement if it exists but I don't know how to do that. I have tried 

command. output = It's not returning anything
command. result = Its always returns 1
Labels (1)
  • to

0 Kudos
1 Reply
VMware Employee
VMware Employee

The Command class is disabled by default:

For temp directory access, you want to use System.getTempDirectory() and the File class. E.g. new File(System.getTempDirectory() + "/temp.txt").exists;