JDoran666 JDoran666 - 2 months ago
259809 0

The Synology DSM automatically indexes new files if they are added via DSM tools. If they are added via eg windows explorer, you need to trigger the reindex manually. This is done by using the synoindex command. The below is a simple script to find files added in the last 15 minutes and add them to the index. Schedule a cron job to run this script every 15 minutes. See further background here : https://codesourcery.wordpress.com/2012/11/29/more-on-the-synology-nas-automatically-indexing-new-files/comment-page-1/#comment-136

Bash

Automatically index new files on Synology NAS

#!/bin/sh -x
logfile="/volume1/homes/admin/etc/IndexDownloads/indexdownloads.log"
recentfile="/volume1/homes/admin/etc/IndexDownloads/recentfile.txt"

echo "-----------------------" >>$logfile
echo 'Starting indexing of new downloads at: '`date` >>$logfile
echo >> $logfile

find /volume1/NBU/Downloads -cmin -15  >$recentfile

#find /volume1/NBU/Downloads -cmin -50 | sed 's/\x27/\\\x27/' | xargs -t -I file synoindex -a \'file\' >>$logfile 2>&1


while read aline
do
  echo "Processing: $aline" >> $logfile 2>&1
  synoindex -a "$aline" >>$logfile 2>&1
done < "$recentfile"


echo >> $logfile
echo 'Ending indexing of new downloads at: '`date` >>$logfile