Skip to content

Instantly share code, notes, and snippets.

@non117
Created September 13, 2014 10:27
Show Gist options
  • Save non117/1e10735d4c85b8a7f771 to your computer and use it in GitHub Desktop.
Save non117/1e10735d4c85b8a7f771 to your computer and use it in GitHub Desktop.
pathlibとshutilを使ってファイルのコピーとか
# -*- coding: utf-8 -*-
import shutil
from pathlib import Path
dst = Path('dst')
lis = open('prior-reedit-sorted.txt').readlines()
for filename in lis:
d,_,_, f = filename.strip().split('_')
path = Path(d) / Path('_'+f)
print(filename[:-1])
shutil.copyfile(path.as_posix(), (dst / filename[:-1 ]).as_posix())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment