Пожалуйста .... сделай это PowerShell?
http://archive.msdn.microsoft.com/PowerShellPack содержит функцию Start-FileSystemWatcher
.
Пожалуйста, не применяйте этот пакетный файл в любой системе.
Powershell.com имеет образцы
Вот образец эта тема :
$folder = '<full path to the folder to watch>'
$filter = '*.*' # <-- set this according to your requirements
$destination = '<full path to the destination folder>'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{
IncludeSubdirectories = $true # <-- set this according to your requirements
NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
}
$onCreated = Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action {
$path = $Event.SourceEventArgs.FullPath
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp"
Move-Item $path -Destination $destination -Force -Verbose # Force will overwrite files with same name
}
В конце концов, отмените регистрацию подписки: Unregister-Event -SourceIdentifier FileCreated