Skip to content

Instantly share code, notes, and snippets.

@martin9700
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martin9700/0dd204f3f6ee5ccbb964 to your computer and use it in GitHub Desktop.
Save martin9700/0dd204f3f6ee5ccbb964 to your computer and use it in GitHub Desktop.
$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