Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$Dir = "c:\dropbox"
$RoboCopyList = Invoke-Expression -Command "Robocopy $Dir NULL /L /S /NJH /NJS /BYTES /FP /NC /NDL /XJ /TS /R:0 /W:0"
ForEach ($File in $RoboCopyList)
{ If ($File -match "(?<Size>\d+)\s(?<Date>\S+\s\S+)\s+(?<Folder>\S+)\\(?<Name>.*$)")
{ [PSCustomObject]@{
Name = $Matches.Name
Size = [int32]$Matches.Size
LastWriteTime = [datetime]$Matches.Date
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment