1 2 3 4 5 6 7 8 9 10 11 12 13
| import os from shutil import copyfile source_dir = "/Users/maqi/SecondBrain/" target_dir = "/Users/maqi/Public/blog/temp/" dirs = os.listdir(source_dir) for cur_dir in dirs: if not cur_dir.__contains__('.'): cur_path = os.path.join(source_dir, cur_dir) files = os.listdir(cur_path) for file in files: if not files.__contains__('.'): copyfile(os.path.join(cur_path, file), os.path.join(target_dir, file))
|