from files_save import CopyMultiFragmentFiles, CopySingleFragmentFiles target_path = r"Z:\Recovered" # 存储各个文件的分片内容列表 fragment_lists = {} test_file_sort = [{'absolute_path': 'Y:\\CloudMusic\\AGA - 一.mp3', 'filename': 'AGA - 一.mp3', 'extent_count': 2, 'start_byte': 23162880, 'length': 69632, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\Aaron Zigman - Main Title.mp3', 'filename': 'Aaron Zigman - Main Title.mp3', 'extent_count': 1, 'start_byte': 687685632, 'length': 7163904, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\AGA - MIZU.mp3', 'filename': 'AGA - MIZU.mp3', 'extent_count': 1, 'start_byte': 694849536, 'length': 8126464, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\AGA - 一.mp3', 'filename': 'AGA - 一.mp3', 'extent_count': 2, 'start_byte': 702976000, 'length': 10870784, 'fragment_index': 2}, {'absolute_path': 'Y:\\CloudMusic\\Anson Seabra - Keep Your Head Up Princess.mp3', 'filename': 'Anson Seabra - Keep Your Head Up Princess.mp3', 'extent_count': 1, 'start_byte': 713846784, 'length': 7970816, 'fragment_index': 1}, { 'absolute_path': 'Y:\\CloudMusic\\Anthony Keyrouz,Romy Wave - Something Just Like This (feat. Romy Wave).mp3', 'filename': 'Anthony Keyrouz,Romy Wave - Something Just Like This (feat. Romy Wave).mp3', 'extent_count': 1, 'start_byte': 721817600, 'length': 9179136, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\Ava Max - Sweet but Psycho.mp3', 'filename': 'Ava Max - Sweet but Psycho.mp3', 'extent_count': 1, 'start_byte': 731000832, 'length': 7938048, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\Cecilia Cheung - Turn Into Fireworks and Fall for You.mp3', 'filename': 'Cecilia Cheung - Turn Into Fireworks and Fall for You.mp3', 'extent_count': 1, 'start_byte': 738938880, 'length': 6791168, 'fragment_index': 1}, {'absolute_path': 'Y:\\CloudMusic\\Color Music Choir - Something Just Like This (Live).mp3', 'filename': 'Color Music Choir - Something Just Like This (Live).mp3', 'extent_count': 1, 'start_byte': 745730048, 'length': 6193152, 'fragment_index': 1}] for item in test_file_sort: extent_count = item['extent_count'] if extent_count == 1: CopySingleFragmentFiles(item, target_path) elif extent_count > 1: CopyMultiFragmentFiles(item, fragment_lists, target_path)