小编Far*_*ton的帖子

排除文件夹内容而不是文件夹本身的正确语法是什么

我有一个从$sourceto复制文件的 powershell 脚本,$dest它排除了某些文件类型。它可以很好地排除我的 csv 文件和 web.config 文件,但不会排除日志文件夹的内容。这是我的脚本,排除文件内容而不是Log文件夹本身的正确语法是什么?

$exclude = @('Thumbs.db','*-Log.csv','web.config','Logs/*')

Get-ChildItem $source -Recurse -Exclude $exclude | Copy-Item -Destination {Join-Path $dest $_.FullName.Substring($source.length)}
Run Code Online (Sandbox Code Playgroud)

powershell

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

powershell ×1