import os
import subprocess


def run(cmd):
    ret = os.system(cmd)
    if ret != 0:
        raise Exception("Command failed: %s" % cmd)

# Assuming local = conan_server and Artifactory remotes
output = subprocess.check_output("conan search -r=local --raw")
packages = output.splitlines()

for package in packages:
    print("Downloading %s" % package)
    run("conan download %s -r=local" % package)

run("conan upload * --all --confirm -r=artifactory")

import os
import subprocess


def run(cmd):
    ret = os.system(cmd)
    if ret != 0:
        raise Exception("Command failed: %s" % cmd)

# Assuming local = conan_server and Artifactory remotes
output = subprocess.check_output("conan search * --remote=local --raw")
packages = output.decode("utf-8").splitlines()

for package in packages[:1]:
    print("Downloading %s" % package)
    run("conan download {} --remote=local".format(package))

run("conan upload * --all --confirm -r=artifactory")

Update Conan server migration script
Update Conan server migration script

  import os
  import subprocess
  
  
  def run(cmd):
      ret = os.system(cmd)
      if ret != 0:
          raise Exception("Command failed: %s" % cmd)
  
  # Assuming local = conan_server and Artifactory remotes
- output = subprocess.check_output("conan search -r=local --raw")
+ output = subprocess.check_output("conan search * --remote=local --raw")
- packages = output.splitlines()
+ packages = output.decode("utf-8").splitlines()
  
- for package in packages:
+ for package in packages[:1]:
      print("Downloading %s" % package)
-     run("conan download %s -r=local" % package)
+     run("conan download {} --remote=local".format(package))
  
  run("conan upload * --all --confirm -r=artifactory")
  
Update Conan server migration script
## Code Before:
import os
import subprocess


def run(cmd):
    ret = os.system(cmd)
    if ret != 0:
        raise Exception("Command failed: %s" % cmd)

# Assuming local = conan_server and Artifactory remotes
output = subprocess.check_output("conan search -r=local --raw")
packages = output.splitlines()

for package in packages:
    print("Downloading %s" % package)
    run("conan download %s -r=local" % package)

run("conan upload * --all --confirm -r=artifactory")

## Instruction:
Update Conan server migration script
## Code After:
import os
import subprocess


def run(cmd):
    ret = os.system(cmd)
    if ret != 0:
        raise Exception("Command failed: %s" % cmd)

# Assuming local = conan_server and Artifactory remotes
output = subprocess.check_output("conan search * --remote=local --raw")
packages = output.decode("utf-8").splitlines()

for package in packages[:1]:
    print("Downloading %s" % package)
    run("conan download {} --remote=local".format(package))

run("conan upload * --all --confirm -r=artifactory")
