# 设置源文件夹和目标文件夹的路径
$sourceFolder = "D:\a" # 将 "D:\a" 替换为实际的文件夹路径
$targetFolder = "D:\b" # 将 "D:\b" 替换为实际的目标文件夹路径
# 获取源文件夹中的所有 mp3 文件
$mp3Files = Get-ChildItem -Path $sourceFolder -Filter "小番茄与火龙果-*.mp3"
# 循环处理每个文件并重命名
foreach ($file in $mp3Files) {
$newFileName = $file.Name -replace "小番茄与火龙果-", "" # 删除 "小番茄与火龙果-" 字段
$newFilePath = Join-Path -Path $targetFolder -ChildPath $newFileName
$file | Rename-Item -NewName $newFileName -Destination $newFilePath
}
标签:power,newFileName,文件夹,file,火龙果,番茄,Path
From: https://www.cnblogs.com/Magiclala/p/17575835.html