使用命令提示符将 select 个图像从一个文件夹复制到另一个文件夹

Using Command prompt to copy select images from one folder to another

我有大量 .jpg 图片文件。我想将 select 数量的图像 (400/1600) 复制到我可以发送给客户的另一个文件夹。 我在 excel 中有一个我需要的图像文件路径列表,所以我可以通过单独复制它们来完成此操作,但这可能需要几天时间...有没有办法在命令提示符或其他方法中执行此操作? 这是其中一些图像的文件路径 Y:\MMS\Data\Mobile 映射最终处理 Data20-JUL-06_SH075\Track_QSphere\Track_Q-Sphere-14.jpg 我想将其复制到 Y:\MMS_SAMPLE_DATA\finalimages

如有任何帮助,将不胜感激

你可以做的是 Select 你的文件路径范围,然后 运行 一个类似于下面的简单宏。

首先在存储文件路径的工作簿中插入一个模块并创建此函数。

Function GetFilenameFromPath(ByVal strPath As String) As String
If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then
    GetFilenameFromPath = GetFilenameFromPath(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function

我从 this threaad

得到这个函数

接下来,在同一模块中创建一个类似于以下内容的极其简单的过程。 (不需要 Microsoft 脚本库)

Sub copy_file_in_selected_range()
Dim current_range As Range, source_path As String, destination_path As String

destination_path = "C:\temp"
For Each current_range In Selection
    source_path = current_range.Value
    FileCopy source_path, (destination_path & "\" & GetFilenameFromPath(source_path))
 Next current_range
End Sub

并将 destination_path 更改为您希望图像复制到的位置

回到你的文件路径sheet,select文件路径范围 使用 Alt-F8 调出 Marco window、select copy_file_in_selected_range 和 运行.

请先进行小批量测试,以确保在 select 大批量之前可以正常工作。