有需要的吗?一键复制选中的图片
924 1
[1 楼] 笨蛋的笨蛋 [资深泡菜]
6-12 10:59
不知道是否有人需要

挑好的图片,一键复制。

简单说就是A目录下图片,按照图片号,复制到B目录下
图片号是个txt文件
保存到yourfile.ps1文件。

<#
  从指定目录a下,把选好的文件,复制到指定目录b下
#>

# CopyFrom, end with \
$copy_from = "C:\set\your\folder\copy\from\"

# CopyTo, end with \
$copy_to = "D:\set\your\folder\copy\to\"

# input file
# format: one file nubmer each line
# 一行一个文件编号
# ex:
#   1000
#   1020
$input_file = "C:\set\your\selected\input\file"

if (-not (Test-Path $copy_from)) {
    Write-Host $copy_from
    Write-Error "copy from folder does not exist."
    exit
}
if (-not (Test-Path $copy_to)) {
    New-Item -Path $copy_to -ItemType Directory
}
# read input file
$read_lines = Get-Content $input_file -Encoding UTF8
# search and copy
foreach($line in $read_lines) {
    Write-Host $line
    $search = "*"+ $line + "*"
    $file_name = Get-ChildItem -Path $copy_from -Recurse -Include $search -Name
    Copy-Item -Path ($copy_from + $file_name) -Destination $copy_to -Force
}
[2 楼] BG7PON [泡菜]
6-12 13:33
新科技吗?