Looking for help on this recursive handler (solved)

@cgrunenberg would have to assess this.

I modified the code to log the found entries.

if (each's type) is in {rtfd, rtf, markdown} then
   set end of l to each's item 1
   do shell script "echo " & (name of each's item 1) & " >> ~/desktop/001.txt"
end if

Running the script from Script Editor and from the toolbar button yield different results.