WatchDirectory Newsletter - Overview of new files

thumbnail - monitor folders

At most once a month we send a newsletter to keep you informed about watchDirectory.
You can unsubscribe anytime you want. We care about your privacy and will not make your email available to other parties.

Subscribe to the English language newsletter
Subscribe Unsubscribe
Den Deutschen Newsletter abonnieren
Abonnieren Kündigen

November 2005 Overview of new files

Someone on our forum asked whether watchDirectory can create an HTML page with the latest files created inside the monitored directory. Below you will find an example script you can use with the run .bat files plugin. Make sure you only select the FILENEW event when you configure the task.

The latestfiles.bat script

The example script uses a program called sqlite3.exe, which is part of the excellent SQLite database engine used by watchDirectory. The sqlite3 program is included in the download at the bottom of this page.
The script selects the 10 most recent files and combines them with a header.txt and footer.txt file to create the final topten.html file.

rem path to sqlite3.exe (no "quotes")
SET SQL=C:\latestfiles\sqlite3.exe

rem where is the header html
SET HEADER=C:\latestfiles\Header.txt

rem where is the footer html
SET FOOTER=C:\latestfiles\Footer.txt

rem where should the final html file be created?
SET FINAL=C:\latestfiles\topten.HTML

rem max number of files to show in html

rem ===============================================
rem ==== no need to change anything below here ====
rem ===============================================


rem create the query, ".mode html" causes the output to be written in html table format
ECHO .mode html > "%TFBASE%.SQL"
ECHO select dtevent, filename from wdevents order by dtevent desc LIMIT %LIMIT%; >> "%TFBASE%.SQL"

rem and start the query
type "%TFBASE%.SQL" | "%SQL%" "%WD_TASKDIR%\history.db" > "%TFBASE%NF.BODY"
del "%TFBASE%.SQL"

rem recreate the html file

Download the Latest Files example. Unzip all files into a new directory. C:\latestfiles would be easiest as the example script is configured to use that directory.

German Website deutschsprachige Webseite      French Website French Language Website      Spanish Website Spanish Language Website