Do shell script problem

Hi all

I am able to decrypt a file issuing the following command in Terminal and works both in bash and in sh:

sudo gpgwrap -p /Users/user/pw.txt gpg -o /Users/user/test.txt -d /Users/user/Documents/msg/22589.emlx

but if I try to use the do shell command to be launched on folder change the onerror message tells that there is no gpgwrap around even after hardcoding the correct full path, with or without the Volume name.

This is the actual code:


on adding folder items to this_folder after receiving these_items
	set outpath to "/Users/user/Documents/msg/test.txt"
	set fpath to POSIX path of these_items
	set cmd to "/usr/local/bin/gpgwrap -p /Users/user/pw.txt gpg -o " & outpath & " -d " & fpath
	
	try
		
		do shell script cmd password "mypwd" with administrator privileges
	on error the error_message number the error_number
		display dialog "si è verificato un errore: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
		
	end try
	
end adding folder items to

I’d really appreciate some help since I ran out of ideas
Luca