Re: How to duplicate or alias a file in Finder?
Re: How to duplicate or alias a file in Finder?
- Subject: Re: How to duplicate or alias a file in Finder?
- From: Nigel Garvey <email@hidden>
- Date: Sat, 19 Mar 2005 12:41:43 +0000
Dennis Jones wrote on Fri, 18 Mar 2005 12:19:10 -0800:
>I need to duplicate a file or make an alias of a file from one foldler
>to a fixed name file/alias in another folder. what is the proper
>syntax?
>
>Here is the code I have so far:
>
>set sourceFolder to "Mac-OS-X:Users:dennisj:Documents:Cathy:Data -
>Rawx:" as string
>set theFile to "050315-CATHY-H05058.txt" as string
>set sourceFile to (sourceFolder & theFile) as alias
>set importFile to "Mac-OS-X:Users:dennisj:Documents:Cathy:Data -
>Importx:import.txt" as alias
>
>tell application "Finder"
> -- duplicate sourceFile to importFile with replacing -- doesn't work
> -- or --
> -- make FinderAlias of sourceFile as importFile -- not even close
>end tell
Using the Finder, it would be something like this:
set CathyFolder to (path to "docs" from user domain as string) &
"Cathy:"
set sourceFolder to CathyFolder & "Data - Rawx:"
set sourceFileName to "050325-CATHY-H05058.txt"
set importFolder to CathyFolder & "Data - Importx:"
set importFileName to "import.txt"
tell application "Finder"
update folder importFolder
try
delete file importFileName of folder importFolder
end try
-- then--
set importFile to (duplicate file sourceFileName of folder
sourceFolder to folder importFolder)
set importFile's name to importFileName
-- or--
make new alias at folder importFolder to file sourceFileName of
folder sourceFolder with properties {name:importFileName}
end tell
If you're going to duplicate the file, Wayne's shell script suggestion
seems to be a little faster, but since your folder names contain spaces,
its necessary to use 'quoted form of POSIX path' rather than just 'POSIX
path'.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden