Hi All,
Not sure if this is the right forum though I am trying to do this in my ASOC App at present.
I have a simple find to get the file count of a folder
set fileCount to do shell script "find /Applications | wc -l"
this freezes the GUI though till it finishes so I want to run it in background
set fileCount to do shell script "find /Applications | wc -l &"
but it won’t run in background with the pipe to “wc”
I would also like to get the process id so I can catch when it finishes
set pid to do shell script "find /Applications | wc -l &> /dev/null & echo $!"
This works but then I don’t have my output so
set pid to do shell script "find /Applications | wc -l &>/tmp/countFiles.txt & echo $!"
That gets the pid and sends output to file but not in background.
Is there a way to run this in background? I could use NSTask I suppose but I don’t want to break the script up yet again.
Thanks Rob