I am trying to make a copy of a file to the root of the drive it resides on. My script keeps failing. Am I referencing the path wrong?
set localFilePath to "/Volumes/SA1 Video/DO NOT DELETE/3Min30sec Checksum Test clip.mov"
set remoteFilePath to "/Volumes/SA1 Video/"
try
do shell script "cp -f" & localFilePath & " " & remoteFilePath
on error
activate
beep 2
display dialog "Can't Copy there !!!!!!!"
end try
two problems with space characters:
¢ there must be a space character after the -f
¢ the source and destination paths must be quoted, because they contain space characters
set localFilePath to "/Volumes/SA1 Video/DO NOT DELETE/3Min30sec Checksum Test clip.mov"
set remoteFilePath to "/Volumes/SA1 Video/"
try
do shell script "cp -f " & quoted form of localFilePath & " " & quoted form of remoteFilePath
on error
activate
beep 2
display dialog "Can't Copy there !!!!!!!"
end try
Nevermind…Here’s what I did wrong. I needed to use the quoted form.
set localFilePath to quoted form of "/Volumes/SA1 Video/DO NOT DELETE/3Min30sec Checksum Test clip.mov"
set remoteFilePath to quoted form of "/Volumes/SA1 Video/"
try
do shell script "cp -f " & localFilePath & " " & remoteFilePath
on error
activate
beep 2
display dialog "Can't Copy there !!!!!!!"
end try
-f For each existing destination pathname, remove it and create a new
file, without prompting for confirmation regardless of its permis-
sions. (The -f option overrides any previous -n option.)