I need to grab the file size of a group of files from a select-string.
There are two folders that i need to manage.
$Source = C:\TEMP\isantillan1 and $Destination = C:\TEMP\isantillan2.
The logic here is, I drop files in $Source and it gets replicated to $Destination. I need to keep track of the size of the files that are changed and new. To do this, i use robocopy with the \L switch.
robocopy C:\TEMP\isantillan1 C:\TEMP\isantillan2 /MIR /IS /L /V /R:3 /W:3 >> C:\TEMP\logs\$date.txt
**********************
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Friday, May 9, 2014 12:56:45 PM
Source : C:\TEMP\isantillan1\
Dest : C:\TEMP\isantillan2\
Files : *.*
Options : *.* /V /L /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /IS /R:3 /W:3
------------------------------------------------------------------------------
14C:\TEMP\isantillan1\
Same 19020amp.txt
Same 49597AppC_Field_Methods.docx
Same 65770Appendix_d_qaqc.docx
Newer 46031Capture.PNG
Newer 23517Capture1.PNG
Same 50041Capture2.PNG
Newer 43427Capture3.PNG
New File 7304franklin_and_prokopik_inv_199451_amount_$216.10 _for_claim_PL-00-00-0564-test.pdf
New File 7415franklin_and_prokopik_inv_199451_amount_$216.10 _for_claim_PL-00-00-0564.pdf
New File 535040PhotomergeUI.8BF
New File 15.0 mpublic_drive_log.txt
New File 15657test.docx
New File 4053tvik_log.txt
New File 1062tvik_log2.txt
**********************
Now with this text file. I do a select-string to get the lines of the files that i want.
PS C:\WINDOWS\system32> Select-String -Path C:\TEMP\logs\2014-05-09.txt -Pattern "Newer", "New File"
C:\TEMP\logs\2014-05-09.txt:20: Newer 46031 Capture.PNG
C:\TEMP\logs\2014-05-09.txt:21: Newer 23517 Capture1.PNG
C:\TEMP\logs\2014-05-09.txt:23: Newer 43427 Capture3.PNG
C:\TEMP\logs\2014-05-09.txt:24: New File 7304 franklin_and_prokopik_inv_199451_amount_$216.10 _for_claim_PL-00-00-0564-test.pdf
C:\TEMP\logs\2014-05-09.txt:25: New File 7415 franklin_and_prokopik_inv_199451_amount_$216.10 _for_claim_PL-00-00-0564.pdf
C:\TEMP\logs\2014-05-09.txt:26: New File 535040 PhotomergeUI.8BF
C:\TEMP\logs\2014-05-09.txt:27: New File 15.0 m public_drive_log.txt
C:\TEMP\logs\2014-05-09.txt:28: New File 15657 test.docx
C:\TEMP\logs\2014-05-09.txt:29: New File 4053 tvik_log.txt
C:\TEMP\logs\2014-05-09.txt:30: New File 1062 tvik_log2.txt
**********
How do i get just the files name above to use it for a Measure-object
Get-ChildItem -Path C:\TEMP\isantillan2 -Recurse | ***files names above*** | Measure-Object -Property length -Sum
Any help would be appreciated.