压缩文件不完整或为空-Powershell

时间:2019-06-12 18:17:18

标签: powershell

使用以下脚本:email to check size / if it's complete  目标:检查zip文件是否为空或不完整,然后发送电子邮件

文件夹A有2个子文件夹:B和C。Zip文件位于文件夹A内,它从A -B -C抓取所有文件并将其压缩。如果其不完整或某种奇怪的原因zip文件为空,请发送电子邮件“ ALERT:

elseif ($fileToCheck -and ($fileToCheck.Length -le 2)) 
# ((($fileToCheck) -and-(Get-ChildItem $fileToCheck | Measure-Object).Count -eq 0))
{
 # second condition: If the file exists and was created today, but has no content or incomplete, e-mail should be sent.

$emailOptions.Subject = "test.zip is empty or Incomplete"
$emailOptions.Attachments = $fileToCheck.FullName
Send-MailMessage @emailOptions
 }

问题:脚本在Powershell上运行,但我没有收到任何电子邮件

0 个答案:

没有答案