On Dec 10, 2009, at 10:39 PM, ba95 wrote: Could you explain the command line a little more so that I can use it, please ?
Here is the complete handler ...
on copyFile(fileAlias, targetAlias, newFileName) -- fileAlias is an alias to the source file, targetAlias is an alias to the destination folder and newFileName is a string set sourcePath to (quoted form of POSIX path of fileAlias) set targetPath to (quoted form of (POSIX path of ((targetAlias as text) & newFileName))) try do shell script "cp -np " & sourcePath & space & targetPath return ((targetAlias as text) & newFileName) as alias end try return {} end copyFile --------------------------------------------------------------------
I use it only for copying files, never folders, so you should pay close attention to Axel's comments regarding folders. This handler preserves "all" properties, but not the Finder comment.
I, too, am afflicted with shell scripting "innocence", but sometimes they are necessary. I used this because 'duplicate' is unable to create the new file with the new name that my script has already created. Using 'cp' avoids a possible file name collision and takes advantage of my prior knowledge of newFileName.
|