# How to transfer directories without their content

**URL:** <https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255>\
**Category:** Help\
**Tags:** go-ipfs\
**Created:** [September 23, 2021, 1:28am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255 "2021-09-23T01:28:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saul](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@Saul](https://discuss.ipfs.tech/u/Saul)\
**Post date:** [September 23, 2021, 1:28am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/1 "2021-09-23T01:28:01Z")

</div>

What I am trying to achieve is to transfer a directory block over sneakernet without having to include any of the content inside - it is assumed that the destination already has the content just missing the directory format.

I understand that directories are a hash containing the hashes of it’s files but clearly it contains a bit of additional information because `ipfs ls` and `ipfs dag get` shows filenames with it. `ipfs block get` gives me data but this data does not appear to correspond to the directory hash because when I pipe the data from `ipfs block get` to `ipfs add` I get a completely different hash. I could recreate the data as a block with the right hash but this isn’t much good to me unless I can add the raw block to the network (like `ipfs add`).

How does IPFS store directory data and how can I access the raw data without it trying to interpret it as a directory?

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [September 23, 2021, 8:06am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/2 "2021-09-23T08:06:04Z")

</div>

> [@Saul](#):
>
> `ipfs block get` gives me data but this data does not appear to correspond to the directory hash because when I pipe the data from `ipfs block get` to `ipfs add` I get a completely different hash

`ipfs block get /ipfs/<folder> | ipfs dag put -f protobuf --input-enc protobuf`

---

<div class="post-metadata">

**Author:** ![Farngi](https://avatars.discourse-cdn.com/v4/letter/f/e95f7d/32.png) [@Farngi](https://discuss.ipfs.tech/u/Farngi)\
**Post date:** [October 9, 2021, 12:35am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/4 "2021-10-09T00:35:34Z")

</div>

This doesn’t work in the new ipfs version 0.10.0 due to change in option flags. I tried with new flags `ipfs block get /ipfs/<folder> | ipfs dag put --store-codec protobuf --input-codec protobuf` but then I got `Error: no decoder registered for multicodec code 80 (0x50)`.

---

<div class="post-metadata">

**Author:** ![Farngi](https://avatars.discourse-cdn.com/v4/letter/f/e95f7d/32.png) [@Farngi](https://discuss.ipfs.tech/u/Farngi)\
**Post date:** [October 9, 2021, 12:41am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/5 "2021-10-09T00:41:44Z")

</div>

Changing codec `protobuf` to `dag-pb` solved it.

---

<div class="post-metadata">

**Author:** ![noname](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@noname](https://discuss.ipfs.tech/u/noname)\
**Post date:** [March 6, 2022, 3:54am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/6 "2022-03-06T03:54:48Z")

</div>

`ipfs block get /ipfs/<folder> | ipfs dag put --store-codec dag-pb --input-codec dag-pb`

I ran this command and got error as below:

`Error: protobuf: (PBLink) wrong wireType (5) for Hash`

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [March 7, 2022, 10:52am UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/7 "2022-03-07T10:52:14Z")

</div>

I’m not sure about the issue but perhaps `ipfs ls --resolve-type=false --size=false /ipfs/<folder>` works the same.

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [March 7, 2022, 2:31pm UTC](https://discuss.ipfs.tech/t/how-to-transfer-directories-without-their-content/12255/8 "2022-03-07T14:31:49Z")

</div>

I’m not positive that I’m correct here but I think you might have problems with this if your directory contains a large number of entries and spans multiple blocks with HAMT.
