[Asterisk-Dev] Question on using system(find args -exec rm {} \; )

Noel Sharpe noels at radnetwork.co.uk
Wed Jan 4 01:58:30 MST 2006


perhaps you need to escape the curly braces? 
exten => s,2,system(find ${PathRecordingTemp}/${CUSTNUM} -mtime +2  
-maxdepth 1  -exec rm \{\} \;) 



bday at prosodiemail.com wrote:

> Rusty,
>  
> Thanks for your response.  Yes the variables were defined and the FIND 
> works ok without the -exec rm since I tested its results by writing 
> the FIND's results to a file, so I think the problem lies with the rm.  
>  
> Thanks
>  
> Bill
>
>     -----Original Message-----
>     *From:* Rusty Dekema [mailto:rdekema at gmail.com]
>     *Sent:* Sunday, January 01, 2006 2:30 PM
>     *To:* Asterisk Developers Mailing List
>     *Subject:* Re: [Asterisk-Dev] Question on using system(find args
>     -exec rm {} \; )
>
>     This is kind of obvious and is probably not the cause of your
>     problem, but it has tripped me up from time to time when trying to
>     code things in the Asterisk dialplan. Are you sure that the two
>     variables you reference (${PathRecordingTemp} and ${CUSTNUM}) have
>     been defined and hold the correct values before you try to
>     reference them in your system call?
>
>     Just a thought; I don't see anything wrong other than that.
>
>     -Rusty
>
>     On 12/30/05, *bday at prosodiemail.com
>     <mailto:bday at prosodiemail.com>* < bday at prosodiemail.com
>     <mailto:bday at prosodiemail.com>> wrote:
>
>         All,
>          
>         I am using Asterisk 1.0.7 and having a problem using
>         system(find ... -exec rm .. ) application as follows.
>          
>         I'm trying to perform a system() application in my dialplan to
>         remove all files that are older than 2 days.  I get a n+101
>         error using the following syntax (yes, there are files in this
>         directory older than 2 days) and was wondering if you see any
>         obvious mistakes in my syntax? 
>          
>         The command works ok on the Command Line, but not inside my
>         dialplan.  I've researched a number of resources and the only
>         thing I can find is in the GNU man pages for FIND where it
>         mentions that I might need to escape the args for the -exec,
>         but I've tried all the escape combinations with no success!  
>         The FIND works ok without the -exec so I have focused my
>         troubleshooting to the -exec portion.  Any suggestions?
>          
>         ;this finds  & removes all files in specified directory that
>         are older than 2 days
>          
>
>     exten => s,2,system(find ${PathRecordingTemp}/${CUSTNUM} -mtime
>     +2  -maxdepth 1  -exec rm {} \;)  
>
>          
>         Thanks
>
>         Bill DAY- SW Engineer
>         ---------------------------------------------
>         PROSODIE Interactive
>         Phone: 954-671-6532
>         Fax: 954-343-5684
>         Corporate: 1-866-PROSODIE
>         bday at prosodiemail.com <mailto:bday at prosodiemail.com>
>         ---------------------------------------------
>         www.prosodieinteractive.com <http://www.prosodieinteractive.com/>
>
>          
>
>         _______________________________________________
>         --Bandwidth and Colocation provided by Easynews.com
>         <http://Easynews.com> --
>
>         Asterisk-Dev mailing list
>         To UNSUBSCRIBE or update options visit:
>           http://lists.digium.com/mailman/listinfo/asterisk-dev
>         <http://lists.digium.com/mailman/listinfo/asterisk-dev>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>--Bandwidth and Colocation provided by Easynews.com --
>
>Asterisk-Dev mailing list
>To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>  
>



More information about the asterisk-dev mailing list