Skip to content

Instantly share code, notes, and snippets.

@martin9700
Last active Aug 29, 2015
Embed
What would you like to do?
$Dir = "c:\dropbox"
$Files = cmd.exe /c "dir $Dir /a-d /-c /s"
ForEach ($File in $Files)
{ If ($File -match "Directory of (?<Folder>.*)")
{ $CurrentDir = $Matches.Folder
}
ElseIf ($File -match "(?<Date>.* [a|p]m) +(?<Size>.*?) (?<Name>.*)")
{ [PSCustomObject]@{
Folder = $CurrentDir
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