Folder create command runs to complete but there is no folder on Windows

When I run the below command , the folder create shows completed in the log file of the windows 8 machine but it did not actually create the folder. However it does work on the linux machine. I have tried in the actions QNA and it shows complete in path of bes console\qna but the folder does not exist

if {name of operating system as lowercase starts with “win”}
folder create {(parent folder of client as string & “\test”)}
//wait cmd.exe /c "md "{(parent folder of client as string & “\Evidence”)}"
else
folder create {(parent folder of client as string & “/test”)}
//folder create "/opt/BESClient/bin/Evidence"
endif

Ooo! I just learned this one. You have mismatched types. Try this for the folder create syntax:

folder create {(pathname of parent folder of client) & "/test"}

Another thing that is good to think about when writing relevance evaluation is that the items between {} are just substitutes so it might be easier to do:

folder create "{ pathname of parent folder of client }/test"

as the substitution will just be put in there.

Note that your Evidence directory is going into the binary directory though, do you mean that?

If you want to go into the directory where __BESData is then:

folder create "{ storage path of client }/test"

Thanks Everyone for your continued support. Problem solved.

If you have time for additional education. How would I add two additional statements if for the below

  1. In addition to checking OS type how would you add a check to see if the folder already exists for both windows and linux similar to
    if {not exists folder (parent folder of client as string & “/Evidence”)}

  2. add after or before the “else” {name of operating system as lowercase contains with “inux”

if {name of operating system as lowercase starts with “win”}
folder create “{pathname of parent folder of client}\Evidence”
else
folder create “{pathname of parent folder of client}/Evidence”
endif

So if I’m understanding correctly for problem 1

if { not exists folder "Evidence" of parent folder of client }

should work as indicated by:

Q: not exists folder "Evidence" of parent folder of client 
A: True

For number 2, in the particular case you are saying you don’t need to make the distinction for the pathname as

folder create "{pathname of parent folder of client}/Evidence"

will work for both Windows and Linux but if you wanted to do something like that you would do:

if { windows of operating system }
    <something>
elseif { unix of operating system } // If you don't care about Linux specifically
    <something>
endif
1 Like

Thanks AlanM. As statement 1 and 2 solves all requirements as I did not know that number 2 would work for both OS types. Thanks for extending the statement example however.