duplicate files in folder very slow

Hi all,

first of all sorry, this might be an absolute newby question, but I the search through the archives didn’t reveal an answer to my question.

as the subject says, I am trying to duplicate all files of a folder into another folder.
I would like to have a status bar, so I thought “tell the finder to duplicate” would be appropriate.
The script I came up with works, but is very slow compared to
a.) a drag and drop action in the finder
b.) an automator action to copy the files
c.) a script which “does shell script ‘ditto’” to copy the files

all three above methods perform on my 300 MB folder in more or less 1 minute, whereas the “tell finder to duplicate” version takes 5 (!!) minutes.

there MUST be something I am doing wrong as automator is also an applescript and out performs my version by a factor of 5!
being a newby to applescript my first guess is that I am doing something stupid.

anyway here’s what I tried:

on run
with timeout of 40 * days seconds
tell application “Finder”
set foldername to “HD:Users:alex:Work:testfolder:”
set theFolder to foldername as alias
make new folder at theFolder with properties {name:“test”}
set srcFolder to (foldername & “version2:”) as alias
set targetFolder to foldername & “test:” as alias
duplicate files of srcFolder to targetFolder
on error e
display dialog e buttons {“Ok”} default button 1 with icon 2
end try
end tell
end timeout
end run

and here is the shellscript version (I a bit more familiar with shell scripts, but it won’t show a nice progress bar)

on run
with timeout of 40 * days seconds
do shell script “ditto -rsrc ~/Work/testfolder/version2/* ~/Work/testfolder/test/”
end timeout
end run

Model: PB G4-1.25
Browser: Safari 419.3
Operating System: Mac OS X (10.4)


to tell the Finder to duplicate files is much slower than a shell command.
The automator action script uses certainly also a “do shell script” line

Thanks for the answer, Stefan.
Now I realize, that the automator action hasn’t a progress dialog either.
pity, so it might not be worth the effort to dig further into applescript in the first place, if such a simple and common task like copying files is 5 times slower, than any other option.

sorry, that this sounds so stupid as the second post in an applescript forum, but that is really what I am asking myself at the moment. I’ll gladly be prooved completely idiot in this regard :wink:

Now my only option seems to be to use a dialog with a “wait” bar without showing the progress.

Do you know this?


maybe this is helpful

Thanks again.
But I don’t know yet, whether to go the easy route and just show a “wait” dialog with a “candy bar” (at least now I know how this striped bar is called :slight_smile: with Platypus http://sveinbjorn.org/platypus. It seems a bit overkill to me to install an applescript application to the users script folder just to copy the files to his drive…

I realized, that I can just use the progress bar script without any third party requirement. Sorry I misunderstood the comments.
The next thing is to determine the length of the process in a laborous script, which goes through recursively into the file hierarchie to count the files and detrmine their size…

Oh well…