Powershell 批量替换文件
2015-06-23 09:43
399 查看
Powershell 批量替换文件
##作者:Xiongpq ##时间:2015-06-10 18:50 ##版本:2.0 ##源文件目录 ##源文件目录的所有文件都会覆盖目标目录的同名文件,源文件目录可以在目标目录内,不会循环覆盖 $source = 'E:\Test_Target\Test_Source\' ##目标目录,支持多个目录 $target = 'E:\Test_Target\', 'D:\Test_Target' $sourceItem = Get-ChildItem -Path $source -recurse foreach ($sourceFileName in $sourceItem) { $targetItem = Get-ChildItem -Path $target -include $sourceFileName.Name -recurse foreach ($targetFileName in $targetItem) { if ($targetFileName.FullName -ne $sourceFileName.FullName){ Copy-Item -Path $sourceFileName.FullName -Destination $targetFileName.FullName -Force } } } Write-Host("DONE.....................")
相关文章推荐
- Linux-shell基础-4
- Bash shell和变量详解
- 用PowerShell把东西pin到开始菜单上
- 三白话经典算法系列 Shell排序实现
- adb shell 命令详解
- PowerShell中实现人机交互
- PowerShell获得剪贴板上的数据
- shell学习二十三天----打印
- Linux Shell之变量
- shell学习二十二天----计算行数,字数以及字符数
- [转]Shell脚本中发送html邮件的方法
- [转]Shell脚本中获取SELECT结果值的方法
- Linux-shell基础-3
- Shell逐行读取文件的4种方法
- shell文字过滤程序(十一):paste命令
- #!/usr/bin/env bash和#!/usr/bin/bash的比较
- Linux-shell基础-2
- 用PowerShell隐藏磁盘驱动器
- [SHELL]20150621前总结——基本常用操作语句
- login shell 和 nologin shell