Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Store result & use again

$
0
0

Hi,

New to PowerShell, i hope you can help.

A script i am writing is going to delete files within folders at different locations on different servers. I am counting how many files are there are at the beginning so my log im creating has the information. 

$filesInLocation = Get-ChildItem $fileLocation -Recurse | Where-Object { !$_.PSIsContainer } | Measure-Object
$filesInLocation.count

So, imagine this tells me i have X amount of documents within the folders, is there a way to save that result? Because, what i would like to do is once the script completes, and the files are deleted, id like to be told again X amount of documents have been deleted.

Hope this makes sense, please, can anybody help?

KW


Viewing all articles
Browse latest Browse all 6937

Trending Articles