Newbie: Copy from volume to ~/documents

Hi all,

I’ve got what should be a simple problem but I’ve been unable to work it out.

I’m trying to create a script that will copy a file from my memory stick to the logged in user’s ~/library/preferences and ~/documents/

What I had in mind was launching the script, it copies the files across - no fiddling around.

I’ve had a look around here and have got a few pointers.

What I’ve got now is


tell application "System Events" to get name of current user
set the_user to result
tell application "Finder"
	set the_folders to "Library:Preferences"
end tell
tell application "Finder"
	duplicate file "Volumes:eMail:reg:01.rtf" to folder the_user & the_folders
end tell

Thank you in advance for any help.

Libwolf

No need to get current user as that is known at run time, so something like this will work for you

tell application "Finder"
	duplicate "Volumes:eMail:reg:01.rtf" to (path to documents folder)
	duplicate "other:file" to (path to preferences folder)
end tell

And the shell version would be

do shell script "cp /Volumes/eMail/reg/01.rtf ~/Documents; cp /other/file ~/Library/Preferences/"

Hi Libwolf,

Somebody should be along writing a script for you, but if you want to see how a reference looks like, try running one of these in the script editor and look at the result:

choose file

or:

choose folder

gl,

Excellent! Just what I needed, thank you!

The shell scripting helped me complete the rest of it as well -

Thank you again!

Libwolf.