<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/1431" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2002-04-04T20:17:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/1431</id>

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-04-04T20:17:00-04:00</updated>

		<published>2002-04-04T20:17:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5982#p5982</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5982#p5982"/>
		<title type="html"><![CDATA[Need Help with tcl script Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5982#p5982"><![CDATA[
Thanks for the comments. Unfortunately the file delete command doesnt return a value. The way around it is to do a check on the file status before deleting:<br><br>proc rf_files {} { <br> global del_path del_files del_timer <br> set a [split $del_files] <br> foreach b $a {<br>  set found 0<br>  set file $del_path/$b<br>  if {[file exists $file]} {<br>   set found 1<br>  }<br>  file delete $file<br>  if {(![file exists $file]) &amp;&amp; ($found)} {<br>   putlog "$file deleted"<br>  }<br> } <br> timer $del_timer rf_files <br> return 0 <br>}<br><br><br>That will check if the file exists before deleting, and then after deleting if the file now doesnt exist and yet it did previously, print a message.<br>The putlog could be easily be a  dccbroadcast.<br><br>&lt;font size=-1&gt;[ This Message was edited by: Mordred on 2002-04-04 17:18 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Thu Apr 04, 2002 8:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-04-04T10:21:00-04:00</updated>

		<published>2002-04-04T10:21:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5966#p5966</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5966#p5966"/>
		<title type="html"><![CDATA[Need Help with tcl script Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5966#p5966"><![CDATA[
Many Thanks Mordred <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br>I had to change the "120" to "5" dang shell!!<br>I kept checking the directory and there is at no time more then 2 or 3 alreadyasked* files in there and the ps -x command shows acceptable cpu/memory usage now.<br>I gave you full credit for the script in the header and the putlog<br>"File Deletion Version 1.0 by Mordred"<br>putlog "File Deletion 1.0 by Mordred loaded"<br>one question, is it possible to make it log or show in dcc chat that its working without constantly checking the shell?<br>Thanks again Mordred <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br><p>Statistics: Posted by Guest — Thu Apr 04, 2002 10:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-04-04T01:35:00-04:00</updated>

		<published>2002-04-04T01:35:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5955#p5955</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5955#p5955"/>
		<title type="html"><![CDATA[Need Help with tcl script Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5955#p5955"><![CDATA[
Try soemthing like this. It executes on startup and every 120 minutes after that.<br><br>#time in minutes to auto delete files <br>set del_timer "120" <br>#directory files are in <br>set del_path "lists" <br>#files in directory to delete <br>set del_files "test1.txt test2.txt test3.txt test4.txt" <br><br>proc rf_files {} { <br>global del_path del_files del_timer<br>set a [split $del_files]<br>foreach b $a {<br> file delete $del_path/$b<br>}<br>timer $del_timer rf_files<br>return 0 <br>} <br><br>if {![info exists rf_files_running]} { <br> rf_files <br> set rf_files_running 1 <br>}<br><br>Of course, change the files and path to your stuff.<br><br>Oh and beware, as you'll see in the code, it's expecting a $del_path without a trailing /<br><br>&lt;font size=-1&gt;[ This Message was edited by: Mordred on 2002-04-03 22:36 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Thu Apr 04, 2002 1:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-04-03T23:51:00-04:00</updated>

		<published>2002-04-03T23:51:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5951#p5951</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5951#p5951"/>
		<title type="html"><![CDATA[Need Help with tcl script Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5951#p5951"><![CDATA[
I need this script to work desperately. My shell keeps killing my trivia bot. Only way to prevent that is to delete files every few hours. Script is below, Any help would be most appreciated <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile">))<br>#file deletion script by Happ version 1.0<br>#<br>#<br>#<br>#time in minutes to auto delete files<br>set timer "120"<br>#directory files are in<br>set del_path "/usr/home/botdoc/testbot/AlreadyAsked"<br>#files in directory to delete<br>set del_files "AlreadyAskedAnimals1.qst AlreadyAskedDemoBank.qst AlreadyAskedMixed1.qst AlreadyAskedScrambleWords1.qst AlreadyAskedmusic1.qst AlreadyAskedquest2.qst AlreadyAskedquest3.qst AlreadyAskedtvmovie.qst"<br>#binds<br>bind dcc x remfiles rf_files<br>########begin script##################<br>$timer rf_files<br>#proc<br>proc rf_files {hand idx arg} {<br>  global del_path del_files<br>  {exec rm $del_files}<br>  return 0<br>}<br><p>Statistics: Posted by Guest — Wed Apr 03, 2002 11:51 pm</p><hr />
]]></content>
	</entry>
	</feed>
