【发布时间】:2023-02-20 19:36:55
【问题描述】:
我在 CSV 文件中的 UNC 路径上有一个文件夹列表,条目看起来像这样 \Server\share\sales\John 我想重命名文件夹 John,使其看起来像 Migrated_John,但我需要使用许多不同的路径来执行此操作,并且脚本需要多次使用。所以我不想为每个条目添加一个带有 new_Name 的列,你能帮忙吗
到目前为止我已经写了这个,但我似乎无法正确地做到这一点
$folders = Import-Csv -Path "C:\temp\FolderList.csv"
foreach ($folder in $folders) {
$oldName = $folder.Path
$newName = "Migrated_" +
Rename-Item $oldName $newName
}
+ 之后应该做什么
【问题讨论】:
标签: powershell rename