Modify folder structure

Mini-guide - 03/01/2017

An example script to notify the change, the removal or the addition of a file in a specific folder.

Inotify is requested.

BASH script

testonoti="File is changed in the Folder"


while inotifywait -qqre modify "$folder"; do
    curl --request GET "$token/text/$(echo ${testonoti// /%20})"

It works in a very simple way. Every time a folder changes, the script sends a notification
To detect the changeInotify was used.

The variables of the script:

  • $tokenPersonal token assigned during the registration process.
  • $testonotiNotification text.
  • $folderPosition of the folder to monitor.

The call structure HTTP GET is very simple.$token/text/$testonoti

Variable name Description Format
$token Personal token. Alphanumeric string
$testonoti Text notification. Text without spaces (use %20)

Execute the script on startup

You can execute the script on startup so that the folder is ALWAYS monitored.

You can use cron, a very popular tool used to plan operations on linux systems.

To execute the script on startup insert the line @reboot sh in crontab.

Dove is the position of the script in the device.

For the execution of the script authorizations are necessary. Authorizations can be given by entering chmod 755

RpiNotify is an Italian project supported by RaspberryItaly

The first Italian RaspberryPi community.