Copy audio files script hits snag

Here’s the script as it is right now:

tell application "System Events"
	set AudioCeeDee to 1st disk whose format is audio format and local volume is true
	set AudioNamen to name of AudioCeeDee
	set Destinashun to 1st disk whose format is Mac OS Extended format and local volume is true
	set DestiName to name of Destinashun
end tell

tell application "Finder"
	set SOngs1 to the (number of items of disk (AudioNamen))
end tell

set GoName to (quoted form of POSIX path of AudioNamen)
set UGoName to quoted form of AudioNamen
set GetSetReadyGo1 to (do shell script "cd" & space & "/Volumes/" & DestiName)
set GetSetReadyGo2 to (do shell script "mkdir" & space & "CopiedAIF")
set FolderETA to space & quoted form of ("/Volumes/" & DestiName & "/CopiedAIF")
set GetSetReadyGo3 to (do shell script "cd" & space & GoName)
set asterisk to "*"
set Go1 to (do shell script "cp" & space & asterisk & ".aiff" & FolderETA)

tell application "Finder"
	set numberOfSongs to SOngs1 as string
	display dialog numberOfSongs & " AIF files copied to disk " & DestiName buttons {"OK"} default button 1
end tell

It hangs on the line
set Go1 to (do shell script “cp” & space & asterisk & “.aiff” & FolderETA)
which is to say, it consistently gives the same error “cp: *aiff : No such file or directory”

Yet a command of the same syntax “cp *aiff /Volumes/BigDisk/CopiedAIF” works fine when entered in Terminal.

What could be the problem? Navigating back to the CD before making the copy (scriptline set GetSetReadyGo1 to (do shell script “cd” & space & “/Volumes/” & DestiName) )? Or is it where I’ve got the asterisk?

Silversleeves

You need to provide the path to *.aif i.e.

set Go1 to (do shell script "cp " & “/Volumes/” & AudioNamen & “*.aiff” & FolderETA)

Hi Silversleeves,

the main problem is, two shell script lines
#1: change directory
#2 do somthing in this directory
doesn’t work. But there is no problem to include the path directly for mkdir and cp.
I would copy the whole directory into a subdirectory of the “CopiedAIF” folder, which makes the syntax very easy.

tell application "System Events"
	set AudioCeeDee to 1st disk whose format is audio format and local volume is true
	set AudioNamen to name of AudioCeeDee
	set Destinashun to 1st disk whose format is Mac OS Extended format and local volume is true
	set DestiName to name of Destinashun
	set SOngs1 to count items of AudioCeeDee
end tell

set GoName to quoted form of POSIX path of AudioNamen
-- set UGoName to quoted form of AudioNamen
try -- to avoid error message if directory already exists
	set GetSetReadyGo2 to (do shell script "mkdir" & space & (quoted form of "/Volumes/" & DestiName & "/CopiedAIF"))
end try

set FolderETA to space & quoted form of ("/Volumes/" & DestiName & "/CopiedAIF")
set Go1 to do shell script "cp -R " & GoName & FolderETA

tell application "Finder"
	set numberOfSongs to SOngs1 as string
	display dialog numberOfSongs & " AIF files copied to disk " & DestiName buttons {"OK"} default button 1
end tell