<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to dynamically change the directory that files are read from?]]></title><description><![CDATA[<p>I have hundreds of data files in different subdirectories that I read into wavetables. I want to dynamically change the directory that the files are read from. I tried sending a dir message to pdcontrol, which appeared to work, but pd does not find the files in the subdirectory. How can I dynamically change the directory that files are read from?</p>
<p><img src="/uploads/files/1776451126606-directory_change.jpg" alt="directory_change.JPG" class="img-responsive img-markdown" /></p>
<p><a href="/uploads/files/1776451106809-file_open.pd">file_open.pd</a></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 09:03:05 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/15856.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Apr 2026 18:43:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Fri, 17 Apr 2026 18:43:15 GMT]]></title><description><![CDATA[<p>I have hundreds of data files in different subdirectories that I read into wavetables. I want to dynamically change the directory that the files are read from. I tried sending a dir message to pdcontrol, which appeared to work, but pd does not find the files in the subdirectory. How can I dynamically change the directory that files are read from?</p>
<p><img src="/uploads/files/1776451126606-directory_change.jpg" alt="directory_change.JPG" class="img-responsive img-markdown" /></p>
<p><a href="/uploads/files/1776451106809-file_open.pd">file_open.pd</a></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from</guid><dc:creator><![CDATA[jamcultur]]></dc:creator><pubDate>Fri, 17 Apr 2026 18:43:15 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Fri, 17 Apr 2026 20:22:56 GMT]]></title><description><![CDATA[<p>the dir message is just getting the directory, not changing it, i think?</p>
<p>in the one that works it looks like you are specifying the directory as part of the path?</p>
<p>so instead you could have $1\0298a.seismic and put [symbol accel( etc. in to read from diff directories.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/2</guid><dc:creator><![CDATA[unclewayback]]></dc:creator><pubDate>Fri, 17 Apr 2026 20:22:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Fri, 17 Apr 2026 20:41:43 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a><br />
Replace &quot;disp&quot; in the read message with a $1 and instead of banging the message send the directory name accel vel or disp into it,,<br />
David.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/3</guid><dc:creator><![CDATA[whale-av]]></dc:creator><pubDate>Fri, 17 Apr 2026 20:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 00:49:12 GMT]]></title><description><![CDATA[<p>Thank you, <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/unclewayback">@unclewayback</a> and <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/whale-av">@whale-av</a> for your replies, but that doesn't solve my problem. The example I gave was a simplified version of what I'm doing. I have 129 files in each directory. The file names are the same in all the directories. (There are three directories now, but there will soon be more.) I have a selectable list of file names and I want to be able to open whatever file was selected in the currently selected directory. I'm currently using $1 in the read message to pass in the selected file name, so I can't use it for the directory name. Is there a way to put two variables in the read message?</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/4</guid><dc:creator><![CDATA[jamcultur]]></dc:creator><pubDate>Sat, 18 Apr 2026 00:49:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 01:39:25 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a> Yes, right click on any message and choose help.  Look at the bottom  left. Also click on [pd dollar-variables]</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/5</guid><dc:creator><![CDATA[jameslo]]></dc:creator><pubDate>Sat, 18 Apr 2026 01:39:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 07:01:55 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a> As <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo">@jameslo</a> says...... something like this....... <a href="/uploads/files/1776493270535-this.pd">this.pd</a><br />
Although you probably want each array in an abstraction with the file name as an abstraction argument or you will have problems with multiple arrays with the same name.... so ignore that....<br />
So see the zip below which uses abstractions.<br />
Dollars in objects are translated as the patch is opened so then you could replace [pack s s] with [pack s $1] and remove the [loadbang]<br />
[EDIT... you cannot as the $1 needs to be a symbol so [loadbang] is still required.... I have changed that in the zip]</p>
<p>The directory selection could be in your master patch and a message sent to the abstractions to change directory.<br />
Note that the $2 in the message is the same as the $1 in the objects in this case.....</p>
<p>Try doing something like this to organise your files and the setting of the tables...... <a href="/uploads/files/1776495711563-this.zip">this.zip</a></p>
<p>You will need to put all the abstractions in your Master patch but you only need to do that once.  Future edits of the abstraction where necessary will be easy.<br />
David.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/6</guid><dc:creator><![CDATA[whale-av]]></dc:creator><pubDate>Sat, 18 Apr 2026 07:01:55 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 06:45:10 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a> Is possible to use openpanel?<br />
see openpanel-help for modes: 0 file 1 directory 2 multiple files<br />
<a href="/uploads/files/1776493996584-directories.zip">directories.zip</a><br />
<img src="/uploads/files/1776493579883-image.png" alt="image.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/7</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/7</guid><dc:creator><![CDATA[Balwyn]]></dc:creator><pubDate>Sat, 18 Apr 2026 06:45:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 09:42:45 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a> maybe this might help, [file cwd] will set the current working directory<br />
The three directories contain the same named files, and the files have different text<br />
I should point out that [file handle] is for binary files and is only used to quickly illustrate the file contents are different<br />
<a href="/uploads/files/1776505041042-select-directory-2.zip">select-directory-2.zip</a><br />
<img src="/uploads/files/1776505051560-image.png" alt="image.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/8</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/8</guid><dc:creator><![CDATA[Balwyn]]></dc:creator><pubDate>Sat, 18 Apr 2026 09:42:45 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 10:03:01 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/balwyn">@Balwyn</a> I wondered about [file cwd]<br />
Does that work? and does Pd still find objects once another directory is set if you then use [declare]?<br />
I have used [file glob] to find directories and search files in the past, but never changed the working directory.<br />
David.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/9</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/9</guid><dc:creator><![CDATA[whale-av]]></dc:creator><pubDate>Sat, 18 Apr 2026 10:03:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 13:45:49 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/whale-av">@whale-av</a> Well it does seem to hold the selected directory for the current patch, but I admit it doesn't change the current system directory when, or after opening other patches or programs.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/10</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/10</guid><dc:creator><![CDATA[Balwyn]]></dc:creator><pubDate>Sat, 18 Apr 2026 13:45:49 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 19:01:11 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/balwyn">@Balwyn</a> Your [file cwd] example looks like exactly what I need, but it didn't work with read. Your example with the close, open message works on my system, but when I tried to use the read message to read the file, I got a &quot;can't read&quot; message. Any ideas on how I can make this work? Thanks!</p>
<p>Edit: I opened issue #2888 on github for the problem that [file cwd] doesn't work with read.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/11</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/11</guid><dc:creator><![CDATA[jamcultur]]></dc:creator><pubDate>Sat, 18 Apr 2026 19:01:11 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sat, 18 Apr 2026 16:44:50 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/whale-av">@whale-av</a> Thanks! This looks promising. I'll give it a try.</p>
<p>Edit: That worked thanks!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/12</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/12</guid><dc:creator><![CDATA[jamcultur]]></dc:creator><pubDate>Sat, 18 Apr 2026 16:44:50 GMT</pubDate></item><item><title><![CDATA[Reply to How to dynamically change the directory that files are read from? on Sun, 19 Apr 2026 04:10:05 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jamcultur">@jamcultur</a> <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/whale-av">@whale-av</a> Well, [file cwd] looks like it only works with [file handle] Sorry</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/13</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15856/how-to-dynamically-change-the-directory-that-files-are-read-from/13</guid><dc:creator><![CDATA[Balwyn]]></dc:creator><pubDate>Sun, 19 Apr 2026 04:10:05 GMT</pubDate></item></channel></rss>