Join two folders?

How would you add a normal folder to an ipfs folder

Can you give an example of what you mean by an “ipfs folder” and what you mean by a “normal folder”?

HASH FOLDER2 + ipfs add -r /FOLDER1

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.


# hash of folder currently in IPFS


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" )

echo $HASH
1 Like

ipfs object patch add-link; this command can combine HASHFOLDER + REGULAR FILE, should be easy to add hashfolder+ folder functionality or even hashfolder+hashfolder

Yeah, that seems like it would be a reasonable enhancement to merge the links from two IPFS directories.

so off to github we go

1 Like