Next: , Previous: Sample, Up: Top



4 Invoking fileschanged

This is the output of the command fileschanged --help:

Usage: fileschanged [OPTION...] [FILE]...
Monitors FILEs for alterations.  Display the filenames of FILEs that were
created, changed, deleted, started execution or finished executing.

  -s, --show=EVENT[,...]     Display created, changed, deleted, executing, or
                             executed files (Default is "created,changed")
  -a, --show-all             Display all file events and the associated action
  -f, --files-to-monitor     (Default) Monitor the FILEs on the command line
  -l, --filelist=FILE        Monitor the list of filenames inside FILE
  -L, --dereference          Don't monitor symlinks, monitor what's pointed to
  -r, --recursive            Monitor subdirectories of directories
  -t, --timeout=N            Delay showing changed files for N seconds (Def=2)
  -p, --display-action       Display action when showing altered files
  -x, --exec=PROG            Run PROG when file is altered (PROG action
                             filename)
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

FILEs must exist when monitoring begins, or they will not be monitored.

Report bugs to <benasselstine@users.sf.net>.

fileschanged supports the following options:

-p
--display-action
Report action when reporting altered files. Instead of reporting just the filename, this option forces fileschanged to state the action before the filename. The following is a list of actions that fileschanged can state: created (A), changed (M), deleted (R), started-executing (E), finished-executing (X).
-s
--show=EVENT
Show filenames when an EVENT happens. Events are: created, changed, deleted, executing, executed, and all. created and changed events are turned on by default if no other events are specified.
-c
--show-created
Show newly created files. This option is turned on by default. If you are monitoring a directory, and a new file is created inside that directory then this option will ensure that any new files are reported. If a new sub-directory is created inside of a directory that fileschanged is monitoring, it will not be monitored unless you've specified the -r (–recursive) option on the command-line. If this option is used in conjunction with the -C (–show-changed) option then reporting will be delayed until no further writes have been detected. The number of seconds in this delay is specified in the -t (–timeout) option. This option is deprecated. Same as –show=created.
-C
--show-changed
Show modified files. This option is turned on by default. When a file you are monitoring is modified, it will be reported as being changed. The reporting will be delayed until no further writes have been detected. Directory files cannot be monitored with fileschanged. This option is deprecated. Same as –show=changed.
-d
--show-deleted
Show deleted files. When a monitored file is deleted or moved it will be reported immediately. This option is deprecated. Same as –show=deleted.
-e
--show-executing
Show executing files. When a monitored file is first executed it will be reported immediately. This option is deprecated. Same as –show=executing.
-E
--show-executed
Show executed files. When a monitored file stops it's execution it will be reported immediately. This option is deprecated. Same as –show=executed.
-f
--files-to-monitor
Monitor the list of files specified on the command line. This option is the default way to specify filenames. fileschanged needs to know what files to monitor for alterations. All files that you specify must exist when fileschanged begins execution or they will not be monitored.
-l
--filelist=FILE
Monitor the list of filenames in FILE. FILE contains a list of absolutely or relatively specified filenames that fileschanged is to monitor. Using this option you can do some interesting things.

i. you can pipe the find command through fileschanged. ii. you can use fileschanged as it's own script. For example you can make a script that looks like:

          #!/usr/bin/fileschanged -l
          ~/mbox
          .xsession-errors
     

All files that you specify must exist when fileschanged begins execution or they will not be monitored.

-r
--recursive
Monitor subdirectories of directories. Monitor files within subdirectories within monitored directories.
-t seconds
--timeout=seconds
Assume changed after N secs of no writes. (Def=2). When a monitored and modified file hasn't been written to for 2 seconds, then report it as changed. The idea here is to detect when a file is finished being written to (eg. finished changing on disk). If you specify this value as 0 then fileschanged will report that the file has been modified upon every disk write. Note: The default 2 seconds is too small for large files, but works well with small files. This option is used in conjunction with the -C (–show-changed) option.
-a
--show-all
Same as –show=all -p Show when files have been created, changed, deleted, executed, or if a file has finished executing. Along with the filename, show the kind of event.
-x PROG
--exec=PROG
Run PROG when file is altered (PROG action filename). Will execute `PROG' with the action and filename as parameters whenever that event occurs. Action is one of A, M, R, E or X. Filename is an absolutely specified path to the file.
-L
--dereference
Don't monitor symlinks, monitor what's pointed to. Use this option to monitor the files that symbolic links point to, instead of monitoring the symlink itself.