Showing posts with label applescript. Show all posts
Showing posts with label applescript. Show all posts

Tuesday, April 01, 2008

applescript with rsync (pt 3)

Perseverance pays off again. This script works perfectly. The "exit" command at the end of the rsync command is what logs out of the Terminal when it's done. Thanks to Macscripter and the Apple Developer Website...so here it is:


The only thing you would have to change is take out the "-n" which makes it do a dry run so you know what will happen before you jump in with both feet, and change your username. And since it's checking "window 1" for the logout string you should make sure you bring terminal back to the front if you use something else so the script can find it.

applescript with rsync (pt 2)

I've found a partial solution to my problem of making a good little app to back up my files to an external hdd. Now I have a really short little script that opens a terminal window and runs rsync:
tell application "Terminal"
activate
do script "rsync -rlpt --progress --stats ~username/ /volumes/macdrive/username" in front window
end tell

I still have a problem, though. I'd like it to logout of terminal and close the window when it's done. If I put a dialog so it doesn't close until I've clicked okay the dialog times out and the script stops running. So I have to look for a way to make the dialog wait indefinitely.

Tuesday, March 18, 2008

applescript with rsync and an external HDD

I've been working on a solution for easily syncing my files to an external hard drive for a while now. I'm almost there, but I thought I'd post what I have so far. I've culled ideas from many sources, specifically here, here, and here. Just one problem. I'd like the process to open a terminal window and echo the file copying progress while it's doing it so I can have an idea how much is being copied. The way this script works I don't know how long it's going to take, it just reports with a dialog when it's done. Hence the ineffectual options in the shell script--I would like them to be showing what they are doing. Here's the script:
display dialog "Backing up now."
do shell script "rsync -rlpt --progress --stats ~username/ /volumes/macdrive/username"
display dialog "Your backup is done."
If anyone knows how to make it echo the progress and stats, give a holler.