2026/4/17 16:33:17
网站建设
项目流程
网站网页切换怎么做的,wordpress备份方法,营销推广策略有哪些,百度网站建设公司哪家好oppo 至今没有一个助手#xff0c; 有一个助手是升级系统的 有一个connect实际上是做镜像手机屏幕的 当然#xff0c;也能监控文件变化 对于我有一个camera文件夹2000个文件 导致我每次不开着手机#xff0c;导出文件到pc经常会断开连接。 然后如果重新connect#x…oppo 至今没有一个助手有一个助手是升级系统的有一个connect实际上是做镜像手机屏幕的当然也能监控文件变化对于我有一个camera文件夹2000个文件导致我每次不开着手机导出文件到pc经常会断开连接。然后如果重新connect会到处一堆xxx(1) 这样的文件完全没有什么 断点续传、文件存在检测这样的功能可见oppo 是没有以顾客为中心啊。插入usb传输文件后copilot 帮写了一个检测文件名是否存在存在则复制到我的备份磁盘不存在那么跳过的代码dump_videos.pyD:\XTRANS\cuda\03-graph-db\04-cmkg\phone\dump_videos.pyimportwin32com.clientimportosimporttimedeflist_and_copy_videos(device_name,path_components,dest_rootNone):shellwin32com.client.Dispatch(Shell.Application)# 17 ssfDRIVES (This PC / My Computer)computershell.NameSpace(17)# Destination setupdest_shell_folderNoneifdest_root:ifnotos.path.exists(dest_root):try:os.makedirs(dest_root)exceptOSErrorase:print(fError creating destination directory {dest_root}:{e})return# Get Shell Folder for destinationdest_shell_foldershell.NameSpace(dest_root)ifnotdest_shell_folder:print(fError: Could not get ShellFolder for {dest_root})returnprint(fDestination folder ready:{dest_root})current_folderNone# 1. Find the device in This PCprint(fSearching for device:{device_name}in This PC...)# Note: If executed in a non-interactive session, ensure Shell.Application is available.found_deviceFalseforitemincomputer.Items():# Using simple Name match. Sometimes display name might vary slightly.ifitem.Namedevice_name:current_folderitem.GetFolder found_deviceTruebreakifnotfound_device:print(fError: Device {device_name} not found.)print(Available devices/drives (in This PC):)foritemincomputer.Items():print(f -{item.Name})return# 2. Traverse the path componentsprint(fDevice found. Navigating path:{ - .join(path_components)})forcomponentinpath_components:foundFalseitemscurrent_folder.Items()foriteminitems:ifitem.Namecomponent:# Check if it is a folder. Note: Some MTP folders might report weird types, but IsFolder works usually.ifitem.IsFolder:current_folderitem.GetFolder foundTruebreakifnotfound:print(fError: Folder {component} not found in {current_folder.Title}.)print(Available items in current folder:)foriteminitems:# Only printing folders to reduce noise, or first 20 itemsprint(f -{item.Name}{[Dir]ifitem.IsFolderelse})returnprint(fTarget folder reached:{current_folder.Title})# 3. Recursively list and copy videosoutput_filevideo_list_3.txtprint(fScanning for videos (MOV, MP4, MKV, AVI, etc)...)ifdest_root:print(fSyncing to{dest_root})video_extensions(.mov,.mp4,.m4v,.mkv,.webm,.avi,.3gp,.ts,.flv,.wmv,.asf)stats{found:0,copied:0,skipped:0,errors:0}found_videos_paths[]defrecursive_scan(folder,relative_path):try:itemsfolder.Items()exceptExceptionase:print(fAccess denied or error reading folder{relative_path}:{e})returnforiteminitems:try:ifitem.IsFolder:new_pathos.path.join(relative_path,item.Name)# print(fScanning: {new_path})recursive_scan(item.GetFolder,new_path)else:nameitem.Nameifname.lower().endswith(video_extensions):full_rel_pathos.path.join(relative_path,name)stats[found]1found_videos_paths.append(full_rel_path)ifdest_rootanddest_shell_folder:# Flattened unique check: check if filename exists in dest_root# (ignoring relative source path structure for the check, as requested comparison with E:\...\files)target_pathos.path.join(dest_root,name)ifos.path.exists(target_path):print(f[SKIP]{name}(already exists))stats[skipped]1else:print(f[COPY]{name}-{target_path})try:# CopyHere flags:# 4 (no progress dialog) | 16 (yes to all) | 256 (simple progress)# Using 256 to show some Windows progress if it takes long, or 0 (default).# Since we are doing file by file, lets suppress UI if possible (4)# but MTP copy can be slow.dest_shell_folder.CopyHere(item,16)# 16 Respond to Yes to All for any dialog box# Very crude wait mechanism because CopyHere is async# Waiting for file to appeartimeout60# secondsstart_waittime.time()whilenotos.path.exists(target_path):time.sleep(0.5)iftime.time()-start_waittimeout:print(fWarning: Timeout waiting for{name}to appear.)break# Optional: Check if size is growing? skipping for speed.# Just a small sleep to avoid flooding COMtime.sleep(0.5)ifos.path.exists(target_path):stats[copied]1else:stats[errors]1exceptExceptionascopy_err:print(fError copying{name}:{copy_err})stats[errors]1exceptExceptionase:# Sometimes accessing properties of MTP items fails randomlyprint(fError processing item:{e})recursive_scan(current_folder,)withopen(output_file,w,encodingutf-8)asf:forvinfound_videos_paths:f.write(v\n)print(-*40)print(fScan Sync Complete.)print(fTotal Found:{stats[found]})print(fCopied:{stats[copied]})print(fSkipped:{stats[skipped]})print(fErrors:{stats[errors]})print(fList saved to{os.path.abspath(output_file)})if__name____main__:# Required: pip install pywin32# Phone NameDEVICE_NAMEOPPO Find X8s# Source Path on Phone (MTP uses Names not drive letters)PATH_PARTS[内部共享存储空间,DCIM,Camera]# Target Directory on PC# User requested: E:\20260127-视频TARGET_DIRrE:\20260127-视频list_and_copy_videos(DEVICE_NAME,PATH_PARTS,dest_rootTARGET_DIR)