Thanks to the comments I decided to use one of the scripts from this recommendend AskUbuntu post.
I just copied it to a file, saved it to my ~/bin (in my case as generate-thumbnails) and issued
chmod +x on it. Then I just navigated to the ~/Documents folder and ran
generate-thumbnails * I don't know How long it took, but when I woke up the next, all was good.
Be aware that you might need to install
sudo apt-get install gir1.2-gnomedesktop-3.0
Since it doesn't waste time generating duplicates, it would be a low impact cron job (after the first run).
From a terminal prompt
crontab -e If it is your first time editing the crontab, it will ask you to choose an editor. I just use nano and I'll give the keyboard commands for it.
Add the following to the end...
0 4 * * * /home/user/bin/generate-thumbnails /home/user*
- Ctl o Will save the file.
- Ctl x Will exit. (it you have a syntax error it'll let you know and you can just
crontab -e again. This sets up cron to run at 4am every morning.
- If you want to change it or look at other cron options.. https://help.ubuntu.com/community/CronHowto is a good place to find out options.
Main reasons for running this script:
- it will recurse through sub-directories
- it is aware of duplicates
- it works equally well for videos
- it will work in other DE's (I switch often based on what I'm doing)
- it would be good for a cron job
Here is the script.... (Thanks James Henstridge !!
from gi.repository import Gio, GnomeDesktop
def make_thumbnail(factory, filename):
mtime = os.path.getmtime(filename)
# Use Gio to determine the URI and mime type
f = Gio.file_new_for_path(filename)
uri = f.get_uri()
info = f.query_info(
'standard::content-type', Gio.FileQueryInfoFlags.NONE, None)
mime_type = info.get_content_type()
if factory.lookup(uri, mtime) is not None:
print "FRESH %s" % uri
if not factory.can_thumbnail(uri, mime_type, mtime):
print "UNSUPPORTED %s" % uri
thumbnail = factory.generate_thumbnail(uri, mime_type)
if thumbnail is None:
print "ERROR %s" % uri
print "OK %s" % uri
factory.save_thumbnail(thumbnail, uri, mtime)
def thumbnail_folder(factory, folder):
for dirpath, dirnames, filenames in os.walk(folder):
for filename in filenames:
make_thumbnail(factory, os.path.join(dirpath, filename))
factory = GnomeDesktop.DesktopThumbnailFactory()
for filename in argv[1:]:
if __name__ == '__main__':