Powershell mail all files from directory and move them

Get-ChildItem “C:\FilePorts\ValidationPDFs\*” -include *.pdf | foreach { Send-MailMessage -from “from@mail.com” -to “to@mail.com” -subject $_.name -attachments $_.fullname -smtpServer mail.server }
Get-ChildItem “C:\FilePorts\ValidationPDFs\*” -include *.pdf | move-item -destination “C:\FilePorts\ValidationPDFs\printet”

Leave a Reply

Your email address will not be published. Required fields are marked *