powershell - PowerShell脚本检查文件夹中的文件
问题描述
需要你的帮助我有点卡住了我需要创建一个powershell脚本,它从csv文件中获取id号,然后检查一个特定文件夹(和所有子文件夹)中所有文件名中存在该id号的文件,然后将所有文件移动到我选择的文件夹中
提前感谢
解决方案
我希望它会帮助你。
$fileNames = gc Your\csv\path\MyCSVFile.csv
foreach($file in $fileNames)
{
Get-ChildItem -Path your\source\folder\path\SourceFolder -Recurse | Where-Object {$_.Name -eq $file} | Move-Item -Destination your\dest\folder\path\DestinationFolder
}
推荐阅读
- ubuntu-18.04 - 带有 ROS 包的“gpg:密钥服务器接收失败:连接被拒绝”
- python-3.x - 如何以 24 小时为间隔绘制熊猫数据框?(多个地块)
- android - 如何在 Android recyclerVIew 中单击项目时保存状态
- ruby-on-rails - 如何从 ActiveRecord 实例中获取关联名称
- math - 函数 |x| 在 0 处的子梯度值是多少?
- angular - 提交按钮在 FormGroup 中不起作用
- python - Tkinter 回调中的异常:AttributeError:“NoneType”对象没有属性“更新”
- reactjs - 这个条件语句在 .map 函数中是如何工作的?
- gradle - 将项目的依赖添加到我的自定义 gradle 插件中
- python - 根据扩展名列表在文件树中查找文件