This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

doing something the moment a file is created

Old posts that have not been replied to for several years.
Locked
j
jamesp0tter
Voice
Posts: 10
Joined: Wed Jan 29, 2003 7:23 pm

doing something the moment a file is created

Post by jamesp0tter »

well, something like the topic states.. like, the moment i create a file, the eggdrop will *do something*, like getting the file content and posting it somewhere, then deleting it and wait for another creation.

can this be done or do i have to bind the *proc of checking file exists* to each minute? :\

tkx in advance
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

There is no Tcl way to trace file changes, and I don't know about other program based versions.

Even if there are any commands that can be used (not pure Tcl that is), it would be far simpler to do a check using timers.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

in tcl-commands.doc are all binds availble listed.
j
jamesp0tter
Voice
Posts: 10
Joined: Wed Jan 29, 2003 7:23 pm

oki.. another question :) (sorry)

Post by jamesp0tter »

ppslim:

hmm, ok.. so, i'll put a timer that checks if a file exist every 30 seconds or so.. don't you think that'll use lots of memory? :\
i'm trying to find the most accurate and less-memory-used proc..
could you give your opinion pls :)
is timers the best? :)

tkx
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

It all depends, your question was rather vague.

Are you checking to see if any old file is created?

Are you looking for a file with a specific name?

Any file within a certain set of directories?
j
jamesp0tter
Voice
Posts: 10
Joined: Wed Jan 29, 2003 7:23 pm

Post by jamesp0tter »

nope, just a specific file, one only, in one dir as well..
i was thinking about sending the info to a mysql table & then tell bot to grab it, but that's other issue..
so, just to check if, for ex "somefile.txt" exists in curr dir, is the best method to use timers?

tkx [] :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Code: Select all

proc our_checkfile {file time} {
  if {[file exists $file]} { our_fileexists $file }
  utimer $time [list our_checkfile $file $time]
}

out_checkfile /home/ppslim/text.txt 30
That will check for the file every 30 seconds, and call "our_fileexists" if it's there.
j
jamesp0tter
Voice
Posts: 10
Joined: Wed Jan 29, 2003 7:23 pm

:)

Post by jamesp0tter »

tkx 4 your help :)
[]
Locked