8
I would like to know if I can get the URL of a file to share in my Dropbox folder from command line. I would avoid to open the web browser every time.
8
I would like to know if I can get the URL of a file to share in my Dropbox folder from command line. I would avoid to open the web browser every time.
15
You can download the Dropbox client for Linux on Dropbox's Website.
This package will install both the Dropbox daemon (which automatically syncs files to a folder if you configure it to), and the dropbox
command line utility.
NOTE: Due to changes made to the Public folder by Dropbox, the instructions below no longer work.
In order to obtain a link to a file in Dropbox from the command line, you must now use the
sharelink
command instead ofpuburl
. For more information, please see jbrock's answer detailing the use of that command.For more information about the changes to the Public folder, please see this Dropbox help topic.
Assuming you have the Dropbox client installed and in your path, you can get a link to a file in your Public folder using the command:
dropbox puburl <path-to-file>
For example:
dropbox puburl ~/Dropbox/Public/somepic.jpg
However, this will not work for files outside your Public folder, it will simply give the error:
Couldn't get public url: Unknown Error
For more information about the dropbox command line interface, you can read the unofficial wiki.
Just in case you just want to avoid going to the website, instead of needing a pure command-line solution, here's an alternative method.
For URLs to files outside the Public folder, it seems you have to use either the website or use a plugin that adds Dropbox-specific functionality to your file manager. By default, Dropbox supports integration with the Nautilus file manager (aka GNOME Files) for the GNOME desktop environment.
If you have Dropbox integration with your file manager, you can right click on a file and choose the "Share Dropbox Link" item in the "Dropbox" submenu. This will copy a link into your Clipboard.
You can usually tell if you have Dropbox integration with your file manager if, when you browse to your Dropbox folder in the file manager, green check marks appear over synced files.
Depending on your Linux distribution, plugins for different desktop environments may be available in the package repositories. For example, on Linux Mint there are plugins available for Nemo (Cinnamon, package is nemo-dropbox
) and Caja (MATE, package is caja-dropbox
).
5
Dropbox recently added the ability to create a share link (not just puburl
) from command line as well as other new CLI features. For me this is great news. I discovered today that Thunar Dropbox Plugin is causing Dropbox to crash for version 3.16.1. So, I am going to just integrate Dropbox CLI into my Thunar context menu via 'Configure custom actions...' I needed to use Dropbox's Python script for new features such as creating a share link to work. Here is the usage:
sharelink
dropbox sharelink FILE
Prints out a shared link for FILE.
Be sure to read the first three paragraphs on this page before getting started. https://www.dropbox.com/en/help/9192
To add a context menu item in Thunar, I went to 'Edit' > 'Configure custom actions...' and added this command:
dropbox sharelink %f | tr -d '\n' | xsel -ib
Here is a script I have written that integrates Dropbox in Thunar. It could also be used for other file browsers.
Here is the output of: dropbox help
Dropbox command-line interface
commands:
Note: use dropbox help <command> to view usage for a specific command.
status get current status of the dropboxd
throttle set bandwidth limits for Dropbox
help provide help
puburl get public url of a file in your dropbox's public folder
stop stop dropboxd
running return whether dropbox is running
start start dropboxd
filestatus get current sync status of one or more files
ls list directory contents with current sync status
autostart automatically start dropbox at login
exclude ignores/excludes a directory from syncing
lansync enables or disables LAN sync
sharelink get a shared link for a file in your dropbox
proxy set proxy settings for Dropbox
Doesn't seem to offer the functionality from command line. – Meetai.com – 2015-03-09T08:07:26.613
Yes, it does - it says "
dropbox puburl ~/Dropbox/Public/somepic.jpg
". – appas – 2015-05-22T21:48:11.663unfortunately the link to the wiki is broken. Great post though, not working for files outside the public folder got me good! – kevinf – 2015-11-14T20:33:29.453
@kevinf thanks for letting me know, I've updated my answer with a fixed link to the unofficial Dropbox wiki. It seems they are now hosting it themselves instead of using the Dropbox forums. – antipode – 2016-03-22T20:37:24.740
How do I download the
– mbigras – 2017-03-20T21:58:04.577dropbox
cli? Is this the project dropbox/dbxcli?The
dropbox
CLI is installed alongside the Dropbox client software. I've added basic instructions to the answer on where to download it. – antipode – 2017-03-22T21:50:52.090