Not getting result from ditto

Hi everyone,

From within Applescript I run a ditto command, which works fine.
However, I would like to see the results back in Applescript, in order to write these to a log.

In Terminal the ditto -V switch outputs results. However, if I run ditto -V from my Applescript, no results are returned.

This is my test sample code. It should open up a dialog displaying the ditto result, but the dialog is empty.
The command it self works fine.

display dialog (do shell script ("ditto --hfsCompression -V " & SourceItem & " " & TargetItem)) as string

Does anyone can explain what is going on?
Thanks in advance.

Hi,

according the docs the output of -v and -V is printed to stderr. You need to redirect the output to stdout

display dialog (do shell script "ditto --hfsCompression -V " & SourceItem & " " & TargetItem & " 2>&1")

The coercion to string and the extra parentheses are not needed.

Hi Stefan,

That works, thanks!

Nico