12

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.

Byte Commander
  • 110,243

2 Answers2

3

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.

A.B.
  • 92,125
2

To get the file name for the thumbnail, start md5sum for the original file name:

% echo -n "file:///home/user/Pictures/image%201.png" | md5sum
6e1669aea9c118cb2b7ad23fc6646c71  -

% find ~/.cache/thumbnails -type f -name "6e1669aea9c118cb2b7ad23fc6646c71*"
/home/user/.cache/thumbnails/large/6e1669aea9c118cb2b7ad23fc6646c71.png

Now remove the read permissions:

chmod -r /home/user/.cache/thumbnails/large/6e1669aea9c118cb2b7ad23fc6646c71.png

Restart nautilus:

nautilus -q

and you will have no thumbnail for /home/user/Pictures/image 1.png.

Now you only have to write a script that scans your particular folders and do the above steps automatically.

Credits :P

A.B.
  • 92,125
Fabby
  • 35,017