# Get folder name in pre-request script section

**URL:** <https://community.postman.com/t/get-folder-name-in-pre-request-script-section/21597>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [March 19, 2021, 3:23pm UTC](https://community.postman.com/t/get-folder-name-in-pre-request-script-section/21597 "2021-03-19T15:23:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kurmavatar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kurmavatar/32/3026_2.png) [@Kurmavatar](https://community.postman.com/u/Kurmavatar)\
**Post date:** [March 23, 2021, 9:01am UTC](https://community.postman.com/t/get-folder-name-in-pre-request-script-section/21597/2 "2021-03-23T09:01:02Z")

</div>

Hi @postmanlen

This thread below should help you with this:

> [@Get Folder Names of a Collection](https://community.postman.com/t/get-folder-names-of-a-collection/9516/2):
>
> 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…

---

_[View the full topic](https://community.postman.com/t/get-folder-name-in-pre-request-script-section/21597)._
