# Get Folder Names of a Collection

**URL:** <https://community.postman.com/t/get-folder-names-of-a-collection/9516>\
**Category:** Help Hub\
**Tags:** tests, collections\
**Created:** [December 10, 2019, 10:10am UTC](https://community.postman.com/t/get-folder-names-of-a-collection/9516 "2019-12-10T10:10:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![john-paul](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/john-paul/32/919_2.png) [@john-paul](https://community.postman.com/u/john-paul)\
**Post date:** [December 11, 2019, 9:52pm UTC](https://community.postman.com/t/get-folder-names-of-a-collection/9516/2 "2019-12-11T21:52:04Z")

</div>

Hi @hbertsch!

Outside of creating a Collection object, there isn’t a Sandbox method for getting folder name right now (but we do have an [open feature request for it](https://github.com/postmanlabs/postman-app-support/issues/6926))

How many folders are you dealing with? What about this:

In each folder, add a pre-request script that sets a local variable with the name of the folder. You’d have to hard-code the folder name value, but if you don’t have a ton of folders this could work:

Folder A —\> Pre-request script —\> `pm.variables.set('folder_name','Folder A');`

Then, any script in your Collection can access the current folder name by using:  
`pm.variables.get('folder_name');`

When the Collection run moves to the next folder, that folder would (ideally) contain the same script, but with it’s own value.

---

_[View the full topic](https://community.postman.com/t/get-folder-names-of-a-collection/9516)._
