'Powershell Compare Files from multiple subfolders
I am trying to create a powershell to compare FILE SIZE from multiple subfolders
Today's files Folder Structure:
- TodaysFolder as a ROOT FOLDER
- TodaysFolder/Business/FolderA/ csv files
- TodaysFolder/Business/FolderB/ csv files
I want to compare today's csv file Size from multiple files / subfolders based on yesterday's data
- Reference Folder Structure:
- ArchiveFolder/YesterdayDate/Business/FolderA/ CSV files
- ArchiveFolder/YesterdayDate/Business FolderA/ CSV files
Also I plan to implement a condition if file size is <= 5 %, PASS If file size is > = 10 % size, FAIL
I will post the current code in a few, but just trying to get some ideas and guidance for this project.
$TodayPath = "\\TodaysFolder\Business/FolderA\"
$TodayFiles = get-childitem $TodayPath -Exclude Archive -Verbose |
? {! $_.PSIsContainer} |
Select-Object Name, @{Name='File Size'; Expression={([string]([int]($_.Length / 1KB))) + " KB"}}
$archiveFolder = (get-date).AddDays(-1).ToString('yyyyMMdd')
$archiveFolderPath = "\ArchiveFolder\YesterdayDate\Business\FolderA"
$ArchiveFiles = get-childitem $archiveFolderPath -Exclude Archive -Verbose |
? {! $_.PSIsContainer} |
Select-Object Name, @{Name='File Size'; Expression={([string]([int]($_.Length / 1KB))) + " KB"}}
write-host $todayPath -ForegroundColor green
$TodayFiles
write-host "---------------------------" -ForegroundColor Red
write-host $archiveFolderPath -ForegroundColor yellow
$ArchiveFiles
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
