[PD] Solution for deleting files via pd?

Hans-Christoph Steiner hans at at.or.at
Mon Jan 28 15:13:36 CET 2013


On 01/28/2013 08:24 AM, Lorenzo Sutton wrote:
> Hi.
> 
> Just a small addition to the various answers
> 
> On 27/01/13 22:25, Sebastian Valenzuela wrote:
>> Hi list,
>>
>> My Pd patch creates and saves new audio files to a designated folder on my
>> desktop. I would like to have Pd delete these files every time I open my
>> patch ([loadbang]).
>>
>> I've heard the [shell] object is a possibility, but i'm not too keen on
>> terminal commands or how they will pertain to [shell]...
> It would be helpful if you specified on with Operating System you are, because
> [shell] is heavily OS dependent (I'm guessing Windows, but I may be wrong)
>>
>> Can anyone please give me an example of a command I would send to [shell] to
>> delete all files within a specified folder on my desktop? If this isn't the
>> best way to do it, is there another possibility through Pd?
> A different strategy might also be to actually *not* delete files from within
> Pd, but outside, befor or after you close your patch. This is easily
> accoplished e.g. by a script.
> 
> Also a suggestion would be to give the temporary files very eloquent names
> such as 'TEMP_FILE_TO_DELETE_0001.wav' etc. and (whichever way you decide to
> do it) delete specifically *those* files instead of e.g. the whole directory,
> so e.g. instead of:
> 
> rm -f ./dir_to_delete/*
> 
> something like
> 
> rm -f ./dir_to_delete/TEMP_FILE_TO_DELETE_*.wav'
> 
> In my humble opinion it makes it more obvious what you want to delete, and
> (hopefully) less error/disaster prone (ok.. I've been bit by accidentally
> deleting files with no back up)
> 
> Lorenzo.

Yes indeed!  Its always a good idea to try to limit delete commands as much as
possible :)

.hc



More information about the Pd-list mailing list