Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Get-childItem issue when sending mail

$
0
0

I'm having a problem where the below command works but not the way it should. For example, if i have two files it will display both files in the email instead of just one. 

$fname=Get-ChildItem \\Main\Drop| Where-Object {!$_.PSIsContainer} 

and here is the body of the email

$Body    = "Check Drop Folder for new file: `n $fname `n`nOR `nclick here: \\Main\Drop\$fname"

If i have 2 files in that drop directory say: file1.txt, file2.txt the email will say:

Check Drop Folder for new file:

file1.txt file2.txt

OR

click here: \\main\Drop\file1.txt file2.txt

I know its a simple fix but im missing it..


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>