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.
#!/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