I am trying to list a directory on remote machine 10.31.236.56
I am using staf for it .the staf document says the command as
LIST DIRECTORY <Name> [RECURSE] [LONG [DETAILS] | SUMMARY] [TYPE <Types>]
[NAME <Pattern>] [EXT <Pattern>] [CASESENSITIVE | CASEINSENSITIVE]
[SORTBYNAME | SORTBYSIZE | SORTBYMODTIME]
so i am using it as
system("staf 10.31.236.56 FS LIST DIRECTORY c:\\RMT\\Log ");
i get the result but when i try t match particular files like
system("staf 10.31.236.56 FS LIST DIRECTORY c:\\RMT\\Log NAME /latest*.*/");
i dont get any response can some one help me ??
Most likely the shell is interpreting the wildcard before it gets passed on to STAF. I’d recommend putting all of the arguments to STAF in quotes so that the shell wouldn’t interfere.
For best results, perhaps avoid using
system(string)to launch the command, and instead use eitherqx{}orsystem(LIST)so that a subshell isn’t called.Perhaps something like this:
When you pass system a single string, it launches a shell, and passes that string as the command to execute. The shell, then, parses that string (including any wildcards), and runs the command. Since you don’t want this to happen (as you don’t want “latest*.*” to be parsed by the shell), you can pass system a list, which would tell it to just launch staf directly.