duplicate file

I have a script that duplicate file from my computer to a external disk call SPEC
here is the script

	tell application "Finder"
		set myFolder to (container of (container of (path to me))) as text
		duplicate file "pao02c03.xls" of folder (myFolder & "pdf:paoli:guest:spec") to disk "SPEC"
	end tell
on error
	return quit
end try

this works well
But when I run this script from “simple finder” it doesn’t work
I feel that it may be because of simple finder doesn’t show disk icon on the desktop but I can access the SPEC disk from file open menu and open and save any file in the SPEC disk

Have any idea or work around

i think i am not clear thats is why i did not get any answer
i found that simple finder can have access to shared and document folder.
but when i open any pdf file from shared folder and then I can save my file on any external drive but i cannot access it. I am not concern about accessing the saved file. I just want to save my file from the shared folder to external drive just but clicking the a script.

please show me some way or any work around.

I can’t test myself, but what do you get if you run this?:

tell app "Finder" to duplicate file "whatever.xls" of folder "whatever" to alias "SPEC:"

Or, maybe, you can do it from a shell script?

set originalFile to posix path of alias "path:to:whatever.xls"
set dest to "/Volumes/SPEC"
do shell script "ditto " & originalFile & space & dest

thank you very much
your second script works for me
but when i run the script it first open up the dialog box and ask me to “run” the script or “quit”
can I avoid this dialog box and just run the script.
the other issuue is that it does not allow me to save the script if the target file is not at the path location.

please help

When you save it as app, just uncheck “Startup screen” (or whatever is called in your OS).
About the second issue, an alias is a file/folder which does EXIST. If the file/folder doesn’t exist, it won’t compile.
So, if you don’t know the location of the file (the user will choose it on-the-fly), etc., you can use a simple path (the same, without the word “alias”) or use a simple variable name. Eg:

set originalFile to (choose file with prompt "Please, choose a file to copy to disk SPEC...")
set originalFile to posix path of originalFile

The var “originalFile” does contain now a valid “real” path, choosen by the user.

thanks jj
this works for me

now have some issues
here is the code that works for me

   set originalFile to "Macintosh HD:Users:Shared:DigitalShowroom:pdf:OfficeSpecialty:bookcase:spec:off52c01.xls" 
   set originalFile to POSIX path of originalFile 
   set dest to "/Volumes/SPECS" 
   do shell script "ditto " & originalFile & space & dest 
on error 
end try

but i notice that if I have a space in folder name in path it doesn’t work
eg.-if “OfficeSpecialty” is written as “Office Specialty” it deosn’t works.

have any idea because i have lots of folder named with spaces.

thanks jj

That’s because you’re using ‘do shell script’ and shell scripts don’t like spaces in pathnames.

To get around this, use ‘quoted form of’ each path. This properly quotes the pathnames so that the shell doesn’t choke on them:

   do shell script "ditto " & quoted form of originalFile & space & quoted form of dest 

Technically the second ‘quoted form’ isn’t required since your destination doesn’t include any spaces, but it’s a good practice.

thanks Camelot
good hint

they gave me some great tips on my issue which i never know.

but now I have some more issues

here is the script that I am working on to copy a file from HD to external drive called “spec” from another user who have access to just “simple finder”
here is the script

set originalFile to alias "Macintosh HD:Users:Shared:Digital Showroom:pdf:paoli:barCounter:spec:pao62c01.xls"
set originalFile to POSIX path of originalFile
set dests to "/Volumes/SPEC"
do shell script "ditto " & quoted form of originalFile & space & quoted form of dests

now i want to add some more features.
here in this script the destination volume is “SPEC”
what if the SPEC is not available and "SPEC 1"is available.
So i want the script should look for any drive whos name start from “SPEC”
and if “SPEC” is not available, it look for “SPEC 1” and if “SPEC 1” is not available it look for “SPEC 2” and so on … and copy the file to any available drive thats name starts from “SPEC…”

hope I explain it well
please help me to solve this problem