file-monitoring

OS-independent API to monitor file system?

ぐ巨炮叔叔 提交于 2020-01-01 05:11:07
问题 I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\user\dirToBeMonitored). So, I could be able to know which filename was added/changed/deleted at every time (or within a reasonable interval). Is this possible with any high-medium level language?. Do you know some API (and

monitoring file and directory access on linux

时光怂恿深爱的人放手 提交于 2020-01-01 01:44:06
问题 Do you know of any linux program, that would monitor accesses to directories and files in the filesystem? I would like to able to produce some report of how many times certain files were accessed in some period? 回答1: You probably want inotify-tools. Inotify is part of the linux kernal that triggers events on watched files, directories, or even the contents of entire directories. These tools are command line utilities that tap into the capabilities of inotify and allow you to use them, for

How to get a file close event in python

不羁岁月 提交于 2019-12-19 00:20:12
问题 Using python 2.7 on windows 7 64 bit machine. How to get a file close event: when file is opened in a new process of file opener (like notepad, wordpad which opens file everytime in new process of wordpad) when file is opened in a tab of file opener (like notepad++, which opens all files in new tab but there exist only a single process of notepad++ running) So, how to get file close event in above cases? Is it possible to achieve above cases through a common code? I am dealing with different

How to get a file close event in python

被刻印的时光 ゝ 提交于 2019-12-19 00:20:04
问题 Using python 2.7 on windows 7 64 bit machine. How to get a file close event: when file is opened in a new process of file opener (like notepad, wordpad which opens file everytime in new process of wordpad) when file is opened in a tab of file opener (like notepad++, which opens all files in new tab but there exist only a single process of notepad++ running) So, how to get file close event in above cases? Is it possible to achieve above cases through a common code? I am dealing with different

The read method on the inotify descriptor does not return

一笑奈何 提交于 2019-12-11 04:23:51
问题 My program monitors changes on files using inotify(7) fd = inotify_init(); inotify_add_watch (fd, "./test.txt", IN_ALL_EVENTS); //start forever monitor while(true){ ssize_t len, i = 0; char action[81+FILENAME_MAX] = {0}; char buff[BUFF_SIZE] = {0}; len = read (fd, buff, BUFF_SIZE); while (i < len) { //process event i += sizeof(struct inotify_event) + pevent->len; } } The problem is that the read function only return several times for the firt changes in the monitor file (ACCESS, OPEN, MODIFY

Continiously tail a local file for new lines using Javascript in a browser

浪尽此生 提交于 2019-12-11 03:54:33
问题 I have a file that gets new lines appended to it frequently. I want to create a web application running in the browser using javascript that will be able to detect changes on that local file and print the new content that is added on the file. My solution includes using javascript polling with setInterval and the new HTML5 File API. I load the file using an input file field and then poll the size of the file. Each time the size changes (in my case increases) this indicates to me that new

Reading updated files on the fly in Python

孤人 提交于 2019-12-11 01:34:46
问题 I'm writing two Python scripts that both parse files. One is a standard unix logfile and the other is a binary file. I'm trying to figure out the best way to monitor these so I can read data as soon as they're updated. Most of the solutions I've found thus far are linux specific, but I need this to work in FreeBSD. Obviously one approach would be to just run my script every X amount of time, but this seems gross and inefficient. If I want my Python app running continuously in the background

Specific file monitor using Apache Commons VFS API

大城市里の小女人 提交于 2019-12-11 01:18:05
问题 I want to perform some operation after a file named (XXXXXX.txt) created in the specific directory. I just don't want to monitor the whole directory. How can i achieve this using Apache Commons VFS API? I tried with the below code, but it did not work out. Any idea about how to achieve this? FileObject listendir1 = fsManager.resolveFile("C:\\Users\\Myname\\AppData\\Local\\Temp\\XXXXXXX.txt"); fileMonitor.addFile(listendir1); fileMonitor.start(); 回答1: Try something like this: FileSystemManager

OS-independent API to monitor file system?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 12:52:11
I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\user\dirToBeMonitored). So, I could be able to know which filename was added/changed/deleted at every time (or within a reasonable interval). Is this possible with any high-medium level language?. Do you know some API (and in which language?) to do this? Thanks. Eric Drechsel A bonified answer, albeit one that requires a

monitoring file and directory access on linux

China☆狼群 提交于 2019-12-03 05:11:46
Do you know of any linux program, that would monitor accesses to directories and files in the filesystem? I would like to able to produce some report of how many times certain files were accessed in some period? You probably want inotify-tools . Inotify is part of the linux kernal that triggers events on watched files, directories, or even the contents of entire directories. These tools are command line utilities that tap into the capabilities of inotify and allow you to use them, for example, in your shell scripts. Specifically, you will probably want to look at inotifywatch Maybe that's what