Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
how to list a directory in realtime
Name: jabalio Date: September 25, 2008 at 11:47:21 Pacific OS: RH Linux CPU/Ram: Linux workstation
Comment:
Hi folks, Does anybody know how to list a directory in real time. (sort of what tail -f would do for a file), I need to be able to constantly poll a directory every 100miliseconds or so to see if a new file appears. if it does i need to exec certain function on them , For simplicity here, you can just assume i want to rename a file if it is created in a directory - in realtime. The dir needs to be polled for any new file created every 100ms. until stopped manually by hitting cntrl-C or similar.
Name: nails Date: September 25, 2008 at 13:36:33 Pacific
Reply:
I'd have to think about it, but you could set up a while loop that sends ls -1t output to a file, execute another ls -l1 and compare that with the previous loop. If they are different then execute your function.
I think that getting 100ms granularity is going to be tough using Linux scripting tools.
0
Response Number 2
Name: wollie Date: September 29, 2008 at 07:07:49 Pacific
Summary: Hi, I'm a beginner script user. It there any shell script example where I could reference on how to check a file in a directory is there before overwrite it in unix AIX 4.3.3. Reg Aixbeginner ...
Summary: i want to replace a file in .zip file in AIX5.3 machine; say i have file script.ksh file and a build.zip file which contains older version of script.ksh. i dont want to zip the entire thing. i want to...
Summary: my problem is i want to replace a line in a file e.g i want to replace the line DBUID= (some name) with DBUID=$user variable file name is sample.ksh DBUID=aruns010 please help me in solving this pro...