Last active
December 2, 2017 21:26
-
-
Save renanregis/12b37a2e6a875f3c451ad33a3186b426 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os, shutil | |
path = "/mnt/volume-nyc3-01/imagens/" | |
with open('JSON/destaque_empresarial.json', encoding='utf-8') as json_file: | |
dados = json.load(json_file) | |
for p in dados: | |
dst_pasta = "/mnt/volume-nyc3-01/ROVIVOPortal/website/media/fotos_legado" | |
for file in os.listdir(path): | |
if p["pasta_imagem"] == file: | |
try: | |
if not os.path.exists(dst_pasta + "/" + file): | |
shutil.move(path + file, dst_pasta) | |
print("Pasta " + file + " movida para " + dst_pasta + "\n") | |
except OSError as err: | |
print("OS error: {0}".format(err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment