核心内容摘要
小程序毕设选题推荐:基于springboot+小程序的微信小程序高校毕业生离校管理系统高校毕业生服务管理系统小程序【附源码、mysql、文档、调试+代码讲解+全bao等】
oppo 至今没有一个助手有一个助手是升级系统的有一个connect实际上是做镜像手机屏幕的当然也能监控文件变化对于我有一个camera文件夹2000个文件导致我每次不开着手机导出文件到pc经常会断开连接。
然后如果重新connect会到处一堆xxx(
这样的文件完全没有什么 断点续传、文件存在检测这样的功能可见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(
# 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#
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#
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})#
Recursively list and copy videosoutput_filevideo_list_
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 (
# but MTP copy can be slow.dest_shell_folder.CopyHere(item,
# 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.
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.