Issue applescript on remote computer

using remote apple events hasn’t worked to well so how could I do this?

do shell script “ssh StudioB@172.0.1.116 "osascript -e ‘tell application "Finder" to move (folders of the desktop whose name begins with "3_do") to the folder (path to music folder)’"”

I get the error error “80:83: syntax error: Expected “,” but found identifier. (-2741)” number 1

Any ideas please?

Think I have it written better

do shell script "ssh StudioB@172.0.1.116
\"osascript -e 'tell application \"Finder\" to move (folders of the desktop whose name begins with \"3_do\") to the folder (path to music folder)'\""

Result:
error “Pseudo-terminal will not be allocated because stdin is not a terminal.
sh: line 1: osascript -e ‘tell application Finder to move (folders of the desktop whose name begins with 3_do) to the folder (path to music folder)’: command not found” number 127

but
this happens
Result:
error “Pseudo-terminal will not be allocated because stdin is not a terminal.
sh: line 1: osascript -e ‘tell application Finder to move (folders of the desktop whose name begins with 3_do) to the folder (path to music folder)’: command not found” number 127

I can do this via shell. like this

do shell script "ssh StudioC@172.0.1.153
rm -rf ~/Desktop/2_do*"

But the problem with the above is that it removes all that begin with “2_do” I need it to remove those that don’t begin with “2_do” and also leave the folders “Hotfolder” and “Keywords” alone.

Hello.

You can move the folders you want to keep somewhere else, before you start deleting, and also copy the files you want to keep to a temp folder, before deleting the rest.

Another approach would be to do the whole delete thing from a shell script, where you test for the name of each item, before you delete it. I think this approach is faster. (NOT TESTED, change the initial path to a test folder
and try/adjust it on testfiles.) You’ll also have to change the mode of the shellscript with chmod gu+x.

#!/bin/bash
for i in ~/Desktop/* ; do 
	if test $i =  folder1 ; then 
		:
	elif test $i = folder2 ; then
		:
	elif echo $i |grep -q "2_do.*" ; then
		:
	else
		rm -rf $i
	fi
done