【发布时间】:2014-03-16 08:21:43
【问题描述】:
我是 Powershell 的新手(截至今天早上)。我已经整理了这个脚本(目录反映了本地测试):
$Destinations = Get-Content "C:\PowerShellConfigFiles\destinationPaths.txt"
$Source = [IO.File]::ReadAllText("C:\PowerShellConfigFiles\sourcePath.txt")
$ExcludeFiles = [IO.File]::ReadAllText("C:\PowerShellConfigFiles\xf.txt")
$ExcludeDirectories = [IO.File]::ReadAllText("C:\PowerShellConfigFiles\xd.txt")
foreach($Destination in $Destinations)
{
robocopy $Source $Destination /E /xf $ExcludeFiles /xd $ExcludeDirectories
}
在我的ExcludeFiles 中有几个扩展名,例如.xlsx。我还想排除根本没有任何扩展名的文件。我还没有找到使用/xf 选项的方法。这可以做到吗,还是我需要探索另一种方法来处理没有扩展名的排除文件?
【问题讨论】:
-
对不起我之前的回答。我太仓促了,误读了你的问题。我刚刚发布了一个你想要的。
标签: powershell robocopy