Created
September 25, 2019 14:54
-
-
Save st-le/6c1a9d134c69790fa9e0aa190b9abfc9 to your computer and use it in GitHub Desktop.
list folders and copy files with python pathlib, os.path, shutil
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 os.path as osp | |
from pathlib import Path | |
import shutil as st | |
print ('hello world') | |
dir = Path('../benchmark_frames/') | |
all_path = [] | |
all_path.append(list(dir.glob('[0-9]'))) | |
all_path.append(list(dir.glob('[0-9][0-9]'))) | |
all_path.append(list(dir.glob('[0-9][0-9][0-9]'))) | |
for list_p in all_path: | |
for p in list_p: | |
dirname = osp.basename(p) | |
# print(str(p) + " " + dirname) | |
dir = Path(p) | |
fl = list(dir.glob('imgTexture.bmp')) | |
print ('\n') | |
for f in fl: | |
print (f) | |
dst = '.\\Rgb_only\\' + dirname + '.bmp' | |
print(dst) | |
st.copy(f, dst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment