Доброго времени суток господа.
Дано: папка DANO- внутри нее субпапки, которые являются папками проекта, с файлами внутри.
Требуется: .exe файл, который будет после выполнения забирать вновь созданные файлы 2-х разрешений, например .file и .porject и копировать их в папку C->FOLDER.
При запуске на след день, из папки C->FOLDER будут удаляться старые файлы .file и .project и перемещаться в C->FOLDER->ARCHIVE, а внутри папки ARCHIVE файлы должны сортироваться по ARCHIVE->ГОД->МЕСЯЦ->ДЕНЬ
Я далек от программирования, но изучая вопрос не нашел софта, на котором можно реализовать такую утилитку.
Думал в сторону скрипта powerrshell:
#By BigTeddy 05 September 2011
#This script uses the .NET FileSystemWatcher class to monitor file events in folder(s).
#The advantage of this method over using WMI eventing is that this can monitor sub-folders.
#The -Action parameter can contain any valid Powershell commands. I have just included two for example.
#The script can be set to a wildcard filter, and IncludeSubdirectories can be changed to $true.
#You need not subscribe to all three types of event. All three are shown for example.
# Version 1.1
$folder = 'C:\PRIMER' # Enter the root path you want to monitor.
$filter = '*.*' # You can enter a wildcard filter here.
# In the following line, you can change 'IncludeSubdirectories to $true if required.
$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{IncludeSubdirectories = $true;NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}
# Here, all three events are registerd. You need only subscribe to events that you need:
Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore green
Out-File -FilePath c:\scripts\filechange\outlog.txt -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
Register-ObjectEvent $fsw Deleted -SourceIdentifier FileDeleted -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore red
Out-File -FilePath c:\scripts\filechange\outlog.txt -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore white
Out-File -FilePath c:\scripts\filechange\outlog.txt -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
# To stop the monitoring, run the following commands:
# Unregister-Event FileDeleted
# Unregister-Event FileCreated
# Unregister-Event FileChanged
$a=Get-Item ($folder+"\/"+$name)
switch ($a.Extension)
{
'.mp3' {Write-Host "AudioFile"; Copy-Item $a.FullName -Destination d:\test\Audio}
'.txt' {Write-Host "TextFile"; Copy-Item $a.FullName -Destination d:\test\Text}
'.bat' {Write-Host "batchfile"}
}
Но ничего не понимая в программировании трудно что то разобрать.