[PD] Solution for deleting files via pd?

Sebastian Valenzuela svalenzuelamusic at gmail.com
Mon Jan 28 17:52:18 CET 2013


Thank you all so much for the great answers :)

Since I posed the question I have been working out a solution. In the
attached file I first send a message to [shell] to tell me how many files
are in the folder. Then, since all the files are named "1.wav", "2.wav",
etc., I run those numbers through a [list-drip] and tell [shell] to delete
them one at a time. It ALMOST works I think, but it has an error that says
"shell: old process still running"... Maybe [list-drip]'s consecutive
messages are too fast? Maybe there is no time between the  first kind of
[shell] command and the second?

Also, I'm a Macbook Pro (4 GB ram) user running 10.7.5 Lion.

I'd appreciate any help with my code. Like I said, I think I'm almost
there, maybe my code needs a little tweaking.

Thank you,
Sebastian


On Mon, Jan 28, 2013 at 7:24 AM, Lorenzo Sutton <lorenzofsutton at gmail.com>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.
>
>>
>> Thank you for your time,
>> Sebastian
>>
>>
>>
>> ______________________________**_________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/**
>> listinfo/pd-list <http://lists.puredata.info/listinfo/pd-list>
>>
>
>
> ______________________________**_________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/**
> listinfo/pd-list <http://lists.puredata.info/listinfo/pd-list>
>



-- 
Sebastian Ignacio Valenzuela Rojas
Composer - Performer
svalenzuelamusic.wix.com/home
youtube.com/svalenzuelamusic <http://www.youtube.com/svalenzuelamusic>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20130128/fbc47030/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clearAudioFolder.pd
Type: application/octet-stream
Size: 1652 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20130128/fbc47030/attachment.obj>


More information about the Pd-list mailing list