Hello everyone, i'm looking for something that could listen to a directory content ( console ) and dynamicaly display it ( and display changes in real-time ) Do you know something ? -- Laurent Renard
Sat, 30 Apr 2005, by lrenard@epicuria.be:
Hello everyone,
i'm looking for something that could listen to a directory content ( console ) and dynamicaly display it ( and display changes in real-time )
Do you know something ?
fam comes to mind. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 9.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.8 + See headers for PGP/GPG info. Claimer: any email I receive will become my property. Disclaimers do not apply.
On Saturday 30 April 2005 19:03, Laurent Renard wrote:
Hello everyone,
i'm looking for something that could listen to a directory content ( console ) and dynamicaly display it ( and display changes in real-time )
watch ls directory
perhaps?
Or if you want it to be closer to real time, a simple program that uses the
file alteration monitor would do it. Something like this (hacked together in
about 5 minutes, to give you the general idea)
#include
Le samedi 30 avril 2005 à 20:24 +0200, Anders Johansson a écrit :
On Saturday 30 April 2005 19:03, Laurent Renard wrote:
Hello everyone,
i'm looking for something that could listen to a directory content ( console ) and dynamicaly display it ( and display changes in real-time )
watch ls directory
perhaps?
Or if you want it to be closer to real time, a simple program that uses the file alteration monitor would do it. Something like this (hacked together in about 5 minutes, to give you the general idea)
#include
#include #include #include #include int main(int argc, char *argv[]){ FAMConnection fc; FAMRequest fr; FAMEvent fe; DIR *dir; struct dirent *entry;
printf("Monitoring directory %s\n", argv[1]);
if(FAMOpen(&fc)){ fprintf(stderr, "Couldn't open connection to FAM daemon\n"); exit(1); }
if(FAMMonitorDirectory(&fc, argv[1], &fr, NULL)) exit(1);
while(FAMNextEvent(&fc, &fe) != -1){ printf("The directory changed\n"); dir = opendir(argv[1]); while((entry = readdir(dir)) != NULL) printf("%s\n", entry->d_name); closedir(dir); } FAMClose(&fc); return 0; } It seems great guys ... let's check it out ;) -- Laurent Renard
Le samedi 30 avril 2005 à 20:24 +0200, Anders Johansson a écrit :
On Saturday 30 April 2005 19:03, Laurent Renard wrote:
Hello everyone,
i'm looking for something that could listen to a directory content ( console ) and dynamicaly display it ( and display changes in real-time )
watch ls directory
perhaps?
Or if you want it to be closer to real time, a simple program that uses the file alteration monitor would do it. Something like this (hacked together in about 5 minutes, to give you the general idea)
#include
#include #include #include #include int main(int argc, char *argv[]){ FAMConnection fc; FAMRequest fr; FAMEvent fe; DIR *dir; struct dirent *entry;
printf("Monitoring directory %s\n", argv[1]);
if(FAMOpen(&fc)){ fprintf(stderr, "Couldn't open connection to FAM daemon\n"); exit(1); }
if(FAMMonitorDirectory(&fc, argv[1], &fr, NULL)) exit(1);
while(FAMNextEvent(&fc, &fe) != -1){ printf("The directory changed\n"); dir = opendir(argv[1]); while((entry = readdir(dir)) != NULL) printf("%s\n", entry->d_name); closedir(dir); } FAMClose(&fc); return 0; }
It seems that i need a few more libs to execute it or is there a place where i could drop it to run ? -- Laurent Renard
On Saturday 30 April 2005 23:21, Laurent Renard wrote:
#include
#include #include #include #include int main(int argc, char *argv[]){ FAMConnection fc; FAMRequest fr; FAMEvent fe; DIR *dir; struct dirent *entry;
printf("Monitoring directory %s\n", argv[1]);
if(FAMOpen(&fc)){ fprintf(stderr, "Couldn't open connection to FAM daemon\n"); exit(1); }
if(FAMMonitorDirectory(&fc, argv[1], &fr, NULL)) exit(1);
while(FAMNextEvent(&fc, &fe) != -1){ printf("The directory changed\n"); dir = opendir(argv[1]); while((entry = readdir(dir)) != NULL) printf("%s\n", entry->d_name); closedir(dir); } FAMClose(&fc); return 0; }
It seems that i need a few more libs to execute it or is there a place where i could drop it to run ?
You need to compile it, and you need to have the package fam-devel installed. Save it in a file called dirmonitor.c, then compile it with gcc -lfam -o dirmonitor dirmonitor.c Then run it with ./dirmonitor <full path to directory to monitor> Or you can get a precompiled version from ftp://rydsbo.net/pub/dirmonitor (source is ftp://rydsbo.net/pub/dirmonitor.c) Then you'll only need to make sure you have fam installed, and that the fam daemon is running (rcfam start) But it really is a very simple program. If you told me what you're after exactly, I could improve it
Le dimanche 01 mai 2005 à 00:03 +0200, Anders Johansson a écrit :
On Saturday 30 April 2005 23:21, Laurent Renard wrote:
#include
#include #include #include #include int main(int argc, char *argv[]){ FAMConnection fc; FAMRequest fr; FAMEvent fe; DIR *dir; struct dirent *entry;
printf("Monitoring directory %s\n", argv[1]);
if(FAMOpen(&fc)){ fprintf(stderr, "Couldn't open connection to FAM daemon\n"); exit(1); }
if(FAMMonitorDirectory(&fc, argv[1], &fr, NULL)) exit(1);
while(FAMNextEvent(&fc, &fe) != -1){ printf("The directory changed\n"); dir = opendir(argv[1]); while((entry = readdir(dir)) != NULL) printf("%s\n", entry->d_name); closedir(dir); } FAMClose(&fc); return 0; }
It seems that i need a few more libs to execute it or is there a place where i could drop it to run ?
You need to compile it, and you need to have the package fam-devel installed. Save it in a file called dirmonitor.c, then compile it with
gcc -lfam -o dirmonitor dirmonitor.c
Then run it with
./dirmonitor <full path to directory to monitor>
Or you can get a precompiled version from
ftp://rydsbo.net/pub/dirmonitor
(source is ftp://rydsbo.net/pub/dirmonitor.c)
Then you'll only need to make sure you have fam installed, and that the fam daemon is running (rcfam start)
But it really is a very simple program. If you told me what you're after exactly, I could improve it
That's great, Anders. I'll test it tomorrow. Thank you for your interest. I'll contact you in a few days ;) -- Laurent Renard
participants (3)
-
Anders Johansson
-
Laurent Renard
-
Theo v. Werkhoven