Duplicate files using Terminal

Howdy all,

This isn’t, oddly enough, an actual applescript question, but rather, something that would be used in an applescript.

Basically, I have 3 folders.
/main/1/2/folder1
/main/1/2/folder2
/main/folder3

I CAN use the “tell application “finder”” duplicate command, but I don’t like how it shows the duplicate progress window. So, unless there is a way to hide that (this is actually a studio app, but I figured this belonged here) I was going to use the ‘do shell script’ command.

Herein lies the catch… terminal is not a strong point of mine. Could someone kindly either point out where I can find such information (eg- ‘man thiscommand’), how I can hide the finder’s ‘duplicate’ window, or tell me what the command I’m looking for to duplicate folders (and replace them if need be?) using terminal?

Thanks,
Parrot

There’s no way to suppress the Finder’s progress window, so you’re down to a shell script.

The command you’re looking for is ‘cp’ (copy). It’s not clear what you’re duplicating, though, so it’s hard to be more specific. However, you’re likely to need some switches - at least ‘-r’ (recursive) if you’re copying directories, but there may be others. man cp should give some pointers.

Edit: Er, nevermind, I should know better. (Merge Folders) :rolleyes:

heh, he’s got a point. There was -R switch there, though. edit- turns out this is needed. You can’t, apparently, select a directory as the source file unless you use it

Anywho, that did it, my files are now copying as I wanted. However, 2 new problems, which I know aren’t uncommon with terminal, are these.

1- The button linked to start this whole mess stays pressed until the copy is complete

2- My progress indicator doesn’t show up anymore, dispite it being called before the copy begins, and being set to using a threaded animation (set uses threaded animation to true). It does, however, show up if an error occurs. I’m sure I’m forgetting something stupid here, though.

Those sound like Studio problems. :wink:

The first one happens with any script; the button will stay pressed until it’s on clicked handler finishes.

Does AppleScript Studio (I don’t know) have an ‘on mouse up’ command as is often used in web pages?

Yes it does Adam: mouse up

Edit: It’s best to use this with a control: Connecting Key and Mouse Event Handlers