Translate This

->

Saturday, April 7, 2012

How to Sync Files and Folders Outside Your Dropbox Folder with Automator (Mac)


In my post 8 Useful Dropbox Tips and Tricks, I explained how you can sync files and folders outside your Dropbox folder by creating symbolic links using the Dropbox Folder Sync addon. While this method did work, I didn’t find it ideal since it wouldn’t let me remove the symbolic link in any simple fashion lest I choose to delete the file or folder itself. Or, at least that’s what I experienced anyways.
Luckily, there is a far better way to sync files outside of Dropbox using the Mac program, Automator. Automator is this really neat program on the Mac that lets you automate many repetitive tasks for you. For example, you can create what are called “workflows” that can rename a large batch of files, or resize numerous images quickly.
In this tutorial, I will create a workflow using the Services template in Automator. Services are these custom context menu bar items you can add to almost any Mac program. This tutorial will show you how to create one that adds a “Sync with Dropbox” option to menu items so that you can easily right-click any file or folder and sync it with Dropbox.

Step 1: Select Services when Automator Launches


Step 2: Change the dropdown menu


After selecting the Services template, change the default dropdown menus so that it reads, “Services receives selected files or folders in Finder.”

Step 3: Use the search bar to add the “Run Applescript” action to the workflow


Simply type in the phrase until you see the name. Then, click and drag it over to your workflow.

Step 4: Replace the text in the Run Applescript window with the following code

on run {input, parameters}

        repeat with i from 1 to (count input)
                set posix_path to POSIX path of (item i of input)
                if posix_path ends with "/" then set posix_path to ¬
                        text 1 thru -2 of posix_path
                set AppleScript's text item delimiters to "/"
                set filesname to quoted form of text item -1 of posix_path
                do shell script "ln -s " & quoted form of posix_path ¬
                        & " " & "~/Dropbox/" & filesname
        end repeat

        return input
end run
This code creates the symbolic link between the file or folder and Dropbox. If your Dropbox folder is located somewhere different, make sure you change line 10 accordingly.

Step 5: Save the workflow and give it a name


Name it something like “Sync with Dropbox.” Now, whenever you right click on any file or folder, you will see a “Sync with Dropbox” menu item. Pretty sweet, eh?

Video!

No comments:

Post a Comment

Jangan Lupa Berilah Komentar!!
Trimakasih atas kunjungannnya.

Related Posts Plugin for WordPress, Blogger...