The program newfileaction (newfaction) invokes a program for each file that newly is created in a directory you want to visit.
It's similar like the "watch" program.
When the watch-program is invoked, it starts a command on the shell
every n seconds
and shows you the results on the screen.
This is good for watching the result of commands every n seconds.
newfaction is slightly different: it invokes the command for each new file in a directory. So for example, if you get all the time new files into your directory (e.g. by copying them from a remote-host to your locval host via ftp or scp) then you can invoke a program for each of these files.
For example you could start your vi-editor for each new file, if you know there are coming text-files, or you could invoke xv for each file, if you know there are coming pictures into the incoming-directory.
newfileaction is programmed in the extraordinary good programming language OCaml.
The executable of the program is called newfaction,
because this is easier to type, than "newfileaction",
which is a long name.
I also thought about calling it "action" or "act" (short for "action"), inspired by the name "watch" of the watch-tool.
Use it without parameters, and it looks in the current directory (pwd)
for files. For each file (ignoring "." and "..") it will invoke
the "echo" program.
If you want to have a different program being invoked, use the "-program" or "-p" option and give the name of the program you want to invoke for each new file.
If you want that newfaction looks inside other directories, use the "-dir" or "-d" option.
If you want the program to be invoked on all new detected files once, use the option "-chunk" or "-c". This will invoke the program of choice with all new filenames as parameters.
The time-interval, when newfaction looks for new files and invokes the actions on these files, are some seconds. You can change the time values by command line options also.
The version 1.0 of newfileaction has the following options:
|-ai||action-intervall-time in seconds|
|-li||lookup-loop intervall-time in seconds|
|-ignoredots||ignore all dot-files|
|-i||ignore all dot-files|
|-chunk||chunk of filenames as parameters (instead individually calling the program for each file)|
|-c||chunk of filenames as parameters (instead individually calling the program for each file)|
|-dir||name of the directory (default: ".")|
|-d||name of the directory (default: ".")|
|-program||name of the program to invoke (default: "echo")|
|-p||name of the program to invoke (default: "echo")|
|-v||print program version and exit|
|-help||help message with list of options|
|--help||help message with list of options|