The ownCloud Public Link Creator

ownCloud Share Link Creator - Context Menu

ownCloud Share Link Creator – Context Menu

Holiday season is the perfect time to work on some stuff on your personal ToDo list. ownCloud 6 introduced a public REST-style Share-API which allows you to call various share operations from external applications. Since I started working on the Share-API I thought about having a simple shell script on my file manager to automatically upload a file and generate a public link for it… Here it is!

I wrote a script which can be integrated in the Thunar file manager as a “custom action”. It is possible that the program also works with other file managers which provide similar possibilities, e.g Nautilus. But until now I tested and used it with Thunar only. If you try the script with a different file manager I would be happy to hear about your experience.

ownCloud Share Link Creator - File Upload

ownCloud Share Link Creator – File Upload

If you configure the “custom action” in Thunar, make sure to pass the paths of all selected files to the program using the “%F” parameter. The program expects the absolute path to the files. In the “Appearance and Conditions” tab you can activate all file types and directories. Once the custom action is configured you can execute the program from the right-click context menu. The program works for all file types and also for directories. Once the script gets executed it will first upload the files/directories to your ownCloud and afterwards it will generate a public link to access them. The link will be copied directly to your clipboard, additionally a dialog will inform you about the URL. If you uploaded a single file or directory than the file/directory will be created directly below your default target folder as defined in the shell script. If you selected multiple files, than the program will group them together in a directory named with the current timestamp.

This program does already almost everything I want. As already said, it can upload multiple files and even directories. One think I want to add in the future is the possibility to detect a ownCloud sync folder on the desktop. If the user selects a file in the sync folder than the script should skip the upload and create the share link directly.

Edit: In the meantime I got feedback that the script also works nicely with Dolphin, Nautilus and Nemo

25 Responses to “The ownCloud Public Link Creator”

  1. upload files to your #ownCloud and generate a public link directly from your desktop file manager #thunar

  2. Björn Schießle’s Weblog » English: The ownCloud Public Link Creator: ownCloud Share Link Creator – Context Men…

  3. e-Jim says:

    Lovely! Will test it asap on Nautilus.

    Thanks a lot.

  4. Neue Publizierung: Bjoern Schiessle (BeS): The ownCloud Public Link Creator #planetdfde

  5. AlfredSK says:

    I can confirm the script is working for files in Nautilus 3.8.2 on Ubuntu 13.10. I did not test this with folders yet.

    Just put the script in $HOME/.local/share/nautilus/scripts.

    Thank you! As I’m coming from UbuntuOne (which has a really good desktop integration) this is a feature I was really missing.


  6. @_Skunnyk_ says:

    “The ownCloud Public Link Creator”, share files from your file browser ! Better than mine, thanks @schiessle 🙂

  7. Huis says:

    Hi Björn,

    it works with KDE Dolphin perfectly!

    Du bist der beste! 🙂

    Guten Rutsch ins Jahr 2014

  8. RT @fkarlitschek: Nice ownCloud Tunar file manager integration by @schiesbn Who does the integration for other f…

  9. @eiosifidis says:

    RT @fkarlitschek: Nice ownCloud Tunar file manager integration by @schiesbn Who does the integration for other f…

  10. gelb says:

    really nice addon. I can confirm that it’s working in nemo, too. Here are some tips, that are maybe helpfull:

    1) for nemo users, create an action in ~/.local/share/nemo/actions/oc.nemo_action
    put the following lines to this file:


    [Nemo Action]
    Name=Share “%N”
    Comment=Share “%N” with owncloud
    Name[de]=”%N” teilen
    Comment[de]=”%N” mit Owncloud teilen


    Put the script to the same folder and set the x-bit. You may name it or replace the name in the file above. If you want to have the owncloud icon in context menu, place the owncloud.png file at /usr/share/icons/YOURTHEME. If you have the sync client installed, you dont’t need to this.

    2) If you have mod_security enabled, you get an error (Username or password does not match), because your request is blocked by your server and the script can’t handle 403 errors. As a solution put a common useragent to your curl options.

    e.g.: curlOpts=”-H User-Agent:Mozilla/5.0 ”

    3) If you access your server in your lan, but you have a dynamic dns for external access, you maybe get share urls with your ip. So you can’t paste them directly. Modify the script to your needs:

    -> find echo $shareLink | xclip -sel clip (createShare function)
    -> add the following code before:

    shareLink=$(echo $shareLink | sed ‘s/xxx\.YOUR\.IP\.xxx/EXTERNAL_IP_ESCAPE_DOTS\.DYNDNS\.TLD/’)

    Have Fun!

    • gelb says:

      There’s a mistake in the action file, because this site masks braces.
      Instead of ‘Exec=’ it must be

      Exec=[less than sign][greater than sign]

      Replace the words and braces with the sign 😉

  11. Got great feedback to my #ownCloud Link Creator People use it successfully with #Thunar, #Dolphin, #Nautilus & #Nemo

  12. @PVince81 says:

    RT @schiessle: Got great feedback to my #ownCloud Link Creator People use it successfully with #Thunar, #Dolphin, #N…

  13. RT @schiessle: Got great feedback to my #ownCloud Link Creator People use it successfully with #Thunar, #Dolphin, #N…

  14. click here says:

    We’ve been a variety of volunteers and starting up the latest plan within our online community. Your web site offered all of us together with useful information and facts to pictures about. You’ve done an outstanding endeavor along with the full area is going to be glad to your account.

  15. RT @schiessle: Got great feedback to my #ownCloud Link Creator People use it successfully with #Thunar, #Dolphin, #N…

  16. profile says:

    It’s the best time in making many ideas for your future and it is time for it to smile. I’ve learn this particular upload and if I could I personally would like to suggest for you couple of interesting difficulties and also ideas. Perhaps you may create upcoming content in regards to this content. I have to discover more areas of this!

  17. ocw says:

    @huis: could you give an example of a working .desktop-file to make the script work in dolphin?
    I tried the following under SUSE with the script in ~/bin without success
    [Desktop Entry]

    [Desktop Action ocshare] “%u”
    Name=Share Link
    Name[de]=Link teilen

    • Huis says:

      ocw@:I put my owncloud.desktop into /usr/share/kde4/services/ServiceMenus and give it chmod 777.
      My owncloud.desktop is:
      [Desktop Entry]

      [Desktop Action ocshare] “%u”
      Name=Share Link
      Name[de]=Link teilen

      Your should have u+x

  18. […] ownCloud Öffentlichen Link im Dateimanager erzeugen […]

  19. Fukurokudzu says:

    What I really need, is smthn like that, but working on windows machine (

  20. ocw says:

    uploaded after I changed the config parameters – but it adds an ” to the created folder in the uploadTarget-Folder (e.g. files?dir=/instant link/Foldername” and can’t show the file inside(?)

    to make it work only for the active user under SUSE I placed the .desktop-file under ~/.kde4/share/kde4/services/ServiceMenus/ – the linked page describes the details for ubuntu

    I also wanted to make it work with kdialog instead of zenity :(but failed atm)

  21. @kirschner says:

    .@schiessle wrote the @ownCloud Public Link Creator (from @fsfe’s

  22. Bernd Müller says:

    works in krusader

    start ActionMan or

    edit ~/.kde4/share/apps/krusader/useractions.xml

    &OCS Share
    Public Link Creator
    /path/to/shareLinkCreator %aCurrent%

    and edit config parameters of shareLinkCreator script.