import shutil
import os
input_path = "C:/Users/hoge/Desktop/プログラミング/python/プログラム/sample02/module03"
input_path_list = input_path.split("/")
output_path = "./output"
for path in input_path_list[input_path_list.index("python") :]:
output_path = os.path.join(output_path, path)
try:
shutil.copytree(input_path, output_path)
except Exception as e:
print(e)
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme