Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # $folderPath = "C:\temp\"
- Write-Host "Running!"
- $file_count = 32963#[System.IO.Directory]::GetFiles($folderPath, "*.pdf", 1).Count # this should remain pretty constant
- $file_count_R = [System.IO.Directory]::GetFiles($folderPath, "*R_*.pdf", 1).Count
- Write-Host "Total Files: ":$file_count
- Write-Host "Progressed Files: ":$file_count_R
- ### Capture the holidays in a HashTable
- ### Could have used an array but thought I might need the name of the holiday eventually
- $Holidays = @{
- "New Year's Day" = Get-Date 'Jan 1'
- "Martin Luther King, Jr. Day" = Get-Date 'Jan 21'
- "Presidents' Day" = Get-Date 'Feb 18'
- "Memorial Day" = Get-Date 'May 27'
- "Independence Day" = Get-Date 'Jul 4'
- "Labor Day" = Get-Date 'Sep 2'
- "Thanksgiving Day" = Get-Date 'Nov 28'
- "Day After Thanksgiving" = Get-Date 'Nov 29'
- "Christmas Day" = Get-Date 'Dec 25'
- }
- ### Initialize the number of working days (this turns out to be my ideal)
- $workingDays = 0
- ### Set the Starting Month/Day
- $StartMonth = 8
- $EndMonth = [DateTime]::Today.Month
- $StartDay = 2
- $EndDay = [DateTime]::Today.Day
- ### Get the number of days in the month
- ### Count the days in the month, excluding weekends and holidays
- for ($month = $StartMonth; $month -le $EndMonth; $month++ )
- {
- $DaysInMonth = [DateTime]::DaysInMonth([DateTime]::Today.Year,$Month)
- if($month==$EndMonth){
- $endDay = $DaysInMonth
- }else{
- $endDay = $EndDay
- }
- for ($day = $StartDay; $day -le $endDay; $day++)
- {
- if (([DateTime]"$Month $day").DayOfWeek -in @('Saturday','Sunday'))
- {
- # Write-Verbose "Weekend! $Month $day"
- }
- elseif($Holidays.ContainsValue([DateTime]"$Month $day"))
- {
- # Write-Verbose "Holiday! $Month $day"
- }
- else
- {
- # Write-Host $month"/"$day
- $workingDays++
- }
- }
- }
- ### Spew the output
- Write-Host "Target Files Completed By Today:"((($workingDays)/40)*$file_count)
- Write-Host "Press any key to continue ..."
- $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- Write-Host
- Write-Host "Finished"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement