Powered By

Powered by Blogger

Rabu, 06 Oktober 2010

Share Any File Or Folder With Dropbox Via Right Click (Nautilus Script) - New Version

Remember the script I've created a while back to share any file from your filesystem with Dropbox via a simple right click? Well, it only supports files - in fact, Dropbox itself doesn't allow you to share folders meaning that if you copy a public folder URL and paste it into your web browser, it won't work. But you can share folders by using Dropbox Index, a Python script which creates an "index.html" file in each folder and links all the files in that folder from the index.html file - if you then share this file via Dropbox and open it in a web browser, you'll be able to access all the files in that folder.

Confusing? A little bit, but let's get to the point: I've combined my Nautilus script with Dropbox Index so you can now use it to share both files and folders from anywhere on your system. Still confusing? This video should make everything clear:





How does sharing files and folders work?


My script creates a symbolic link for any file and/or folder when you right click and select "Dropbox Share" and places this symlink into your "Public" Dropbox folder. Once the files and folders are uploaded to Dropbox, their public links are automatically copied to the clipboard and you can simply "Ctrl + V" to share those links via instant messaging, forum, email or whatever.

This script works with Gnome (Nautilus) and has been tested under Ubuntu 10.04 and 10.10.


Under the hood (technical stuff)


Firstly, let's get this straight: I'm not a programmer or anything like that. I just occasionally make some scripts for my own use and share them. The code may not be pretty but it works. If something doesn't, let me know!

The script can use NotifyOSD for notifications (such as what files you're sharing and when the files have finished uploading). This is enabled by default, but it can be disabled by modifing line 5 of the script from "USENOTIFYOSD=yes" to "USENOTIFYOSD=no"

The first time you run the script, it will download the Dropbox Index script (credits go to osciak1 for this script) and extract it into your ~/.scripts folder. This is required for sharing folders.

Script dependencies: libnotify-bin (optional - enabled by default), wget, xclip (for copying the URLs to the clipboard), Dropbox Index which I told you about above and obviously, Dropbox. There's one more one time dependency for unzip - required to unzip the Dropbox Index script files but if you manually enter the path to the Dropbox Index directory, the script will see it already exists and will skip downloading it (and thus the unzip dependency is not required anymore). 

The script also includes a few checks: it will check if you've installed libnotify-bin (if you've selected to use it), xclip and if Dropbox is running (and if it's not running, it starts Dropbox).

Install Dropbox Share

1. Firstly, let's make sure you don't have the older Dropbox Share script on your system:
rm ~/.gnome2/nautilus-scripts/Dropbox\ Share

2. Install the dependencies:
sudo apt-get install libnotify-bin xclip unzip wget

3. Download the script, make it executable and restart Nautilus:
cd ~/.gnome2/nautilus-scripts/
wget http://launchpadlibrarian.net/57198833/Dropbox%20Share
chmod +x Dropbox\ Share
nautilus -q

Now select any files / folder from your system, right click them and select Scripts > Dropbox Share.


I remind you to always check the contents of a script before running it on your system (even if you don't have to run it with "sudo")!


Credits for Dropbox Index which is used by Dropbox Share: kosciak1.

Tidak ada komentar:

Posting Komentar