This is just a memo for myself.
List files modified after x seconds.
- Recurse: include subdirectories
- Force: include hidden files
- File: file only
Get-ChildItem -Recurse -Force -File | `
where LastWriteTime -gt (Get-Date).AddSeconds(-10) | `
select Name, LastWriteTime
Show tree structure of specified folder.
tree /F <folder>
Watch object creation and update of specified folder.
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "my files path"
$watcher.EnableRaisingEvents = $true
$watcher.IncludeSubdirectories = $true
$action = {
$fullPath = $event.SourceEventArgs.FullPath
$name = $event.SourceEventArgs.Name
$changeType = $event.SourceEventArgs.ChangeType
Write-Host "$changeType $name $path"
}
Register-ObjectEvent $watcher 'Changed' -Action $action
#Get-EventSubscriber | Unregister-Event
Top comments (0)