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]...
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?
Thank you for your time, Sebastian
Hello,
in bash shell that would be something like [rm -rf /home/Sebastian/Desktop/folder( | [ggee/shell]
in ms-dos you can't specify a directory that is not relative to the patch (long story), a simple way would be about making a batch script with this inside:
cd c:\Users\Sebastian\Desktop rd %1
along with your patch
and then
[open yourBatchScript.bat folderToDelete( | [moonlib/popen]
or
[yourBatchScript.bat folderToDelete( | [motex/system]
Colet Patrice
----- Mail original -----
De: "Sebastian Valenzuela" svalenzuelamusic@gmail.com À: "Pure Data Forum" pd-list@iem.at Envoyé: Dimanche 27 Janvier 2013 22:25:48 Objet: [PD] Solution for deleting files via pd?
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]...
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?
Thank you for your time, Sebastian
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 2013-01-27 16: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]...
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?
You can use pdlua for this kind of thing. See the attached patch. Right-click inside the [deletefile] object to open deletefile.pdlua in an editor.
Martin
If you're using Pd-extended 0.43.4, there is the 'tclfile' library, which provides a bunch of objects for file operations:
http://puredata.info/downloads/tclfile/releases/0
Just drop the 'tclfile' folder into user library folder: http://puredata.info/docs/faq/how-do-i-install-externals-and-help-files
.hc
On 01/27/2013 04:25 PM, 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]...
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?
Thank you for your time, Sebastian
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
De: "Hans-Christoph Steiner" hans@at.or.at
If you're using Pd-extended 0.43.4, there is the 'tclfile' library, which provides a bunch of objects for file operations:
http://puredata.info/downloads/tclfile/releases/0
Just drop the 'tclfile' folder into user library folder: http://puredata.info/docs/faq/how-do-i-install-externals-and-help-files
very nice!
just a little precision, once 'tclfile' folder has been dropped, the objects can be called like this
[tclfile/delete]
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
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
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@gmail.comwrote:
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/** listinfo/pd-list http://lists.puredata.info/listinfo/pd-list
______________________________**_________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/** listinfo/pd-list http://lists.puredata.info/listinfo/pd-list
How about creating a new folder each time you open so the last one could be deleted... there is this external done by a colleague of mine.. it builds perfect in OSX 10.6.8
http://puredata.info/Members/estebancalcagno/CreateFolder/view?searchterm=cr... http://puredata.info/Members/estebancalcagno/CreateFolder/view?searchterm=createfolder
just an idea
On Mon, Jan 28, 2013 at 1:52 PM, Sebastian Valenzuela < svalenzuelamusic@gmail.com> wrote:
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@gmail.comwrote:
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/** listinfo/pd-list http://lists.puredata.info/listinfo/pd-list
______________________________**_________________ Pd-list@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
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list