Copy using do shellscript

Hi

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

Kind regards
EM

Hi,

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

Cheers !

and the space after “-f”

thanks Stefan !!!

What exactly does the “-f” parameter do ?

from the manpage cp:

-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.)

Thanks for the link to the man pages. I google’d everywhere for this. Just goes to show that sometimes you just have bad google kharma :wink:

Thanks Stefan