我是powershell的新手。我们在sFTP位置有多个文本文件,需要扫描,如果文件中有多行,则移动到加载过程,如果只有一条记录,则忽略它们,不加载它们。
我能够通过使用下面的代码获得行数,但它没有给我预期的结果。不知道如何实现这一点。任何帮助非常感谢。
$paramDest = "C:\\All\"
Get-ChildItem $paramDest -Filter *.txt |
ForEach-Object { $content = (Get-Content $_.FullName -Delimiter "`r`n" | Measure-Object).Count
$content | Set-Content $_.FullName
}
1条答案
按热度按时间4sup72z81#
这是你要的密码。
如果txt文件等于2行或超过2行,则将继续执行脚本。
**Update1:**请查找以下多个文件的代码:
您可以在$file_have_2_line变量中获取所有文件列表。