# Glob patterns document -- persist\_to\_workspace paths

**URL:** <https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442>\
**Category:** Build Environment\
**Created:** [October 17, 2017, 6:13pm UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442 "2017-10-17T18:13:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kutenai](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kutenai/32/13726_2.png) [@kutenai](https://discuss.circleci.com/u/kutenai)\
**Post date:** [October 17, 2017, 6:13pm UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/1 "2017-10-17T18:13:52Z")

</div>

Can someone expand on the documentation regarding things like glob patterns in persist\_to\_workspace…

the documentation shows a paths: - build/\*, but what are the capabilities beyond that?

Is this a unix glob pattern?

If I had a set of directories (this is a lerna project FYI), i.e.  
./packages/  
/package1/lib/\*  
/package2/lib/\*

Could I use a pattern ./packages/\*\*/lib/\*

I can iteratively test this… but, would love to just see some better docs and examples here… would help the community right

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [October 18, 2017, 8:40am UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/2 "2017-10-18T08:40:14Z")

</div>

We are using `Glob` from Go, and the pattern matches [filepath.Match](https://golang.org/pkg/path/filepath/#Match).

```auto
pattern:
	{ term }
term:
	'*' matches any sequence of non-Separator characters
	'?' matches any single non-Separator character
	'[' ['^'] { character-range } ']'
	            character class (must be non-empty)
	c matches character c (c != '*', '?', '\\', '[')
	'\\' c matches character c

character-range:
	c matches character c (c != '\\', '-', ']')
	'\\' c matches character c
	lo '-' hi matches character c for lo <= c <= hi

```

Per the Go docs:

```auto
The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/'). 

```

So in your specific example `./packages/*/lib/*` should suffice.

Please note that everything must be relative to the work space root directory.

cc @michelle-luna we could probably just snag that right out of the Go docs and put it in ours since its the source of truth.

---

<div class="post-metadata">

**Author:** ![kutenai](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kutenai/32/13726_2.png) [@kutenai](https://discuss.circleci.com/u/kutenai)\
**Post date:** [October 23, 2017, 9:39pm UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/4 "2017-10-23T21:39:45Z")

</div>

This is great info, thanks a lot. This REALLY helps.

PS – this would be a great addition to the main documentation!!

---

<div class="post-metadata">

**Author:** ![michelle-luna](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/michelle-luna/32/25249_2.png) [@michelle-luna](https://discuss.circleci.com/u/michelle-luna)\
**Post date:** [October 24, 2017, 10:32pm UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/5 "2017-10-24T22:32:55Z")

</div>

Awesome, thanks for this! PR for the docs update is here [https://github.com/circleci/circleci-docs/pull/1694](https://github.com/circleci/circleci-docs/pull/1694)

-Michelle

---

<div class="post-metadata">

**Author:** ![brmenchl](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/brmenchl/32/17305_2.png) [@brmenchl](https://discuss.circleci.com/u/brmenchl)\
**Post date:** [October 30, 2017, 3:55pm UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/6 "2017-10-30T15:55:07Z")

</div>

Is this something available for `save_cache` as well? We’re using Yarn Workspaces, and could have large number of `node_modules` directories to cache.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:40am UTC](https://discuss.circleci.com/t/glob-patterns-document-persist-to-workspace-paths/17442/7 "2018-06-18T11:40:00Z")

</div>

Closed on June 18, 2018, 11:40am UTC


