How do I move files from an old folder structure to new?

别说谁变了你拦得住时间么 提交于 2019-12-04 15:46:15

Use a foreach loop with the Get-ChildItem, Copy-Item, and Test-Path Powershell cmdlets:

#Get all address subfolders
$addr_folders = Get-ChildItem c:\"Client Name"\State/Province\City\ -recurse | Where-Object {$_.PSIsContainer -eq $True}

#Loop through all address subfolders
foreach ($address in $addr_folders)
{
  #Copy contents from existing subfolder path to new folder
  if (Test-Path c:\"Client Name"\State/Province\City\"Order Number"\$address)
    {
   Copy-Item c:\"Client Name"\State/Province\City\"Order Number" c:\"Client Name"\State/Province\City\"Order Number - " $address
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!