# Join two folders?

**URL:** <https://discuss.ipfs.tech/t/join-two-folders/3440>\
**Category:** Kubo\
**Created:** [July 19, 2018, 6:02pm UTC](https://discuss.ipfs.tech/t/join-two-folders/3440 "2018-07-19T18:02:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![leerspace](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@leerspace](https://discuss.ipfs.tech/u/leerspace)\
**Post date:** [July 20, 2018, 3:06am UTC](https://discuss.ipfs.tech/t/join-two-folders/3440/4 "2018-07-20T03:06:00Z")

</div>

I’m not sure there’s a single command that will do this easily.

But here’s a simple proof of concept script that will do this.

Assuming `HASH` is the hash of a folder in IPFS, this script will loop through the contents of a local folder named `test2` and add the contents to the existing directory hash. The final hash that’s spit out by the script is the hash of the combined directory.

```auto
#!/bin/bash

# hash of folder currently in IPFS
HASH="QmW85q9pmby55reZb9YrcLRr5L2gHcvTFGoSmjADCbhq1w"

FOLDER2="./test2"

for item in "$FOLDER2"/*; do
	tempname="$(basename "$item")"
	temphash="$(ipfs add --pin=false -r -Q "$FOLDER2"/"$tempname")"
	HASH=$(ipfs object patch add-link $HASH "$tempname" "$temphash" )
done

echo $HASH

```

---

_[View the full topic](https://discuss.ipfs.tech/t/join-two-folders/3440)._
