ゴスロリ@がんばらない: jan Swedneck: FWIW I wrote the script, only merges directories: ```python #!/usr/bin/env python import requests, json, sys # Usage: ipfs_merge_dir.py [dir3 dir4...] # Address of node to use NODE = "http://localhost:5001" # API API = "/api/v0/" # TempDir TEMP = "/merge_tmp" # Creates temp dir in MFS, removing existing one if present def MkTempDir(): RmTempDir() req = requests.post(NODE+API+"files/mkdir?arg="+TEMP) # Removes temp dir (and contents) from MFS def RmTempDir(): req = requests.post(NODE+API+"files/rm?arg=%s&force=true" % TEMP) # Returns CID of the temp dir def CIDTempDir(): req = requests.post(NODE+API+"files/stat?arg=" + TEMP) data = json.loads(req.text) return data["Hash"] # Copies contents of CIDs to temp dir def CpCIDs(cids): req = requests.post(NODE+API+"ls?arg="+cids) dirData = json.loads(req.text) if "Type" in dirData and dirData["Type"] == "error": print(dirData["Message"]) quit() for obj in dirData["Objects"]: if len(obj["Links"]) == 0: print("No links on CID, aborting: " + obj["Hash"]) quit() if obj["Links"][0]["Name"] == "": print("Not a directory: " + obj["Hash"]) quit() for i in obj["Links"]: req = requests.post(NODE+API+"files/cp?arg=/ipfs/%s&arg=/merge_tmp/%s" % (i["Hash"], i["Name"])) if req.text != "": print(req.text) # Parses directories to merge together def parseFlags(): if len(sys.argv) < 3: print("Usage: ipfs_merge_dir.py [dir3 dir4...]") quit() cids = sys.argv[2:] out = sys.argv[1] for i in cids: out += "&arg="+i return out # Main program if __name__ == "__main__": cids = parseFlags() MkTempDir() CpCIDs(cids) print(CIDTempDir()) RmTempDir() ```