Ubuntu – Disable thumbnail creation for specific folders only, but all users

nautilusnemothumbnails

How do I prevent my Ubuntu 14.10 (now 15.04) from creating and saving thumbnails for a specific folder only?
I want to tell the thumbnailer to skip over that single folder (and subfolders), but for all existing and future user accounts.

I read some answered questions about excluding a specific file type, but I need to exclude files by their location!
What I already tried is to hide the folder (renamed to .foldername), but with no luck. The folder is owned by root, by the way.

Best Answer

In addition to @Fabby answer:

  1. Install the package inoticoming

    sudo apt-get install inoticoming
    
  2. Create wrapper script disable_thumbnails

    #!/bin/bash
    
    # Create the thumbnail filename
    tn_filename=$(echo -n "file://$1/$2" | sed 's/\s/%20/g' | md5sum | awk '{print $1}')
    
    # Destroy the thumbnail without deleting
    find ~/.cache/thumbnails -type f -name "$tn_filename*" -print0 | while IFS= read -d '' file; do
      echo > "$file"
    done
    exit 0
    
  3. Make it executable

    chmod +x disable_thumbnails
    
  4. Kill running processes, if necessary

    killall inoticoming
    
  5. Watch your folder

    Avoid a trailing / for the folder names

    inoticoming "<path_to_disabled_thumbnail_folder>" <full_path_of_disable_thumbnails_script>  {} "<path_to_disabled_thumbnail_folder>" \;
    

There is only one problem. The changes are only visible after nautilus -q

Use inoticoming --foreground … to avoid the daemon mode, if you test the script.