移动目录下所有png文件到指定目录内
$RootFolder = Read-Host -Prompt "enter the folder you want to move png files from"
$targetFolder = Read-Host -Prompt "enter the folder you want to move png files to"
Write-Output "your files are being moved..."
# Get all PNG files in the source folder
$pngFiles = Get-ChildItem -Path $RootFolder -Filter *.png -Recurse
# Move each PNG file to the target folder
foreach ($pngFile in $pngFiles) {
$destinationPath = Join-Path -Path $targetFolder -ChildPath $pngFile.Name
Move-Item -Path $pngFile.FullName -Destination $destinationPath
}
Write-Output "PNG files have been moved successfully."
Write-Output "Total PNG files moved: $($pngFiles.Count)"
评论区