Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. # $folderPath = "C:\temp\"
  2. Write-Host "Running!"
  3.  
  4. $file_count = 32963#[System.IO.Directory]::GetFiles($folderPath, "*.pdf", 1).Count # this should remain pretty constant
  5. $file_count_R = [System.IO.Directory]::GetFiles($folderPath, "*R_*.pdf", 1).Count
  6.  
  7. Write-Host "Total Files: ":$file_count
  8. Write-Host "Progressed Files: ":$file_count_R
  9.  
  10.  
  11. ### Capture the holidays in a HashTable
  12.  
  13. ### Could have used an array but thought I might need the name of the holiday eventually
  14.  
  15. $Holidays = @{
  16.  
  17. "New Year's Day" = Get-Date 'Jan 1'
  18.  
  19. "Martin Luther King, Jr. Day" = Get-Date 'Jan 21'
  20.  
  21. "Presidents' Day" = Get-Date 'Feb 18'
  22.  
  23. "Memorial Day" = Get-Date 'May 27'
  24.  
  25. "Independence Day" = Get-Date 'Jul 4'
  26.  
  27. "Labor Day" = Get-Date 'Sep 2'
  28.  
  29. "Thanksgiving Day" = Get-Date 'Nov 28'
  30.  
  31. "Day After Thanksgiving" = Get-Date 'Nov 29'
  32.  
  33. "Christmas Day" = Get-Date 'Dec 25'
  34.  
  35. }
  36.  
  37.  
  38. ### Initialize the number of working days (this turns out to be my ideal)
  39. $workingDays = 0
  40. ### Set the Starting Month/Day
  41. $StartMonth = 8
  42. $EndMonth = [DateTime]::Today.Month
  43. $StartDay = 2
  44. $EndDay = [DateTime]::Today.Day
  45.  
  46. ### Get the number of days in the month
  47.  
  48. ### Count the days in the month, excluding weekends and holidays
  49. for ($month = $StartMonth; $month -le $EndMonth; $month++ )
  50. {
  51. $DaysInMonth = [DateTime]::DaysInMonth([DateTime]::Today.Year,$Month)
  52. if($month==$EndMonth){
  53. $endDay = $DaysInMonth
  54. }else{
  55. $endDay = $EndDay
  56. }
  57. for ($day = $StartDay; $day -le $endDay; $day++)
  58. {
  59. if (([DateTime]"$Month $day").DayOfWeek -in @('Saturday','Sunday'))
  60. {
  61. # Write-Verbose "Weekend! $Month $day"
  62. }
  63.  
  64. elseif($Holidays.ContainsValue([DateTime]"$Month $day"))
  65. {
  66. # Write-Verbose "Holiday! $Month $day"
  67. }
  68. else
  69. {
  70. # Write-Host $month"/"$day
  71. $workingDays++
  72. }
  73. }
  74. }
  75.  
  76. ### Spew the output
  77.  
  78. Write-Host "Target Files Completed By Today:"((($workingDays)/40)*$file_count)
  79.  
  80.  
  81. Write-Host "Press any key to continue ..."
  82.  
  83. $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  84.  
  85. Write-Host
  86. Write-Host "Finished"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement