<p>The <a href="http://buildwithcraft.com/classreference/services/ResourcesService#getResourcePath-detail" rel="nofollow">ResourcesService getResourcePath</a> method will only work for files.</p>

<p>The <a href="http://buildwithcraft.com/classreference/services/PathService#getResourcesPath-detail" rel="nofollow">PathService getResourcesPath</a> method will get you the resources path, after which you can append your folder name.</p>

<pre><code>$folder = craft()-&gt;path-&gt;getResourcesPath() . 'svg/';
</code></pre>

CC BY-SA 3.0
2015-01-04T19:40:23.147Z
2015-01-04T19:40:23.147Z
Ben Croker
<p>I have a plugin that has an folder inside of it's <code>resources</code>. I need to iterate through those files.</p>

<p>To get the path, I tried <code>craft()-&gt;resources-&gt;getResourcePath('folder-name')</code>, but it seems to only succeed if the <em>file</em> exists, not a folder.</p>

<p>I want the folder so I can use <code>IOHelper::getFolderContents($folder)</code>.</p>

<p>Do I just need to build the path myself (<code>$folder = craft()-&gt;path-&gt;getPluginsPath() . 'myplugin/resources/svg/';</code>), or am I missing something?</p>

<plugin-development><filesystem>
getResourcePath() for folders in a plugin
# getResourcePath() for folders in a plugin

(Asked by: username_0 on 2014-12-30)

I have a plugin that has an folder inside of it's `resources`. I need to iterate through those files.

To get the path, I tried `craft()->resources->getResourcePath('folder-name')`, but it seems to only succeed if the *file* exists, not a folder.

I want the folder so I can use `IOHelper::getFolderContents($folder)`.

Do I just need to build the path myself (`$folder = craft()->path->getPluginsPath() . 'myplugin/resources/svg/';`), or am I missing something?

**Tags:** plugin-development, filesystem


---

## 1 answers

### Answer by username_1 on 2015-01-04. Score: 4 | Accepted answer

The ResourcesService getResourcePath method will only work for files.
The PathService getResourcesPath method will get you the resources path, after which you can append your folder name.
$folder = craft()->path->getResourcesPath() . 'svg/';


---

