D
D
Dima Kim2016-06-17 08:45:47
PowerShell
Dima Kim, 2016-06-17 08:45:47

Directory monitoring and deleting files with mail notification, how to implement?

Good afternoon, there is a directory, it is shared and connected as a network drive,
the task is
to monitor the structure of this disk (directory) for new files, delete everything except txt, notify by mail, maybe there are ready-made solutions?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2016-06-17
@jalpy

if the shared resource is located on a windows server OS (I’ll say for sure now for 2008 and above), then use the features of the manager: turn on screening.
notification, emnip, they are also configured there.
If on the client OS - https://gallery.technet.microsoft.com/scriptcenter...
In the "created" block (and just in case in changed, because no one canceled the option with creating a .txt file and then changing its permission ) do processing by file type.
Well, sending a message can be implemented via send-mailmessage
If you are not familiar with powershell, then write on the command line get-help about_switch -examplesfor actions depending on the file extension.
Also get-help send-mailmessage -examplesfor setting up sending a message.

A
Alexey, 2016-06-17
@skazi_premiere

Is PowerShell everything you need. If you have the role of a file server, then you can restrict the writing to the resource of everything except txt and, depending on the settings, notify the administrator.

C
CityCat4, 2016-06-17
@CityCat4

I don’t know who are ready, I would weaken the scripter on PowerShell / VBS, which does this by running in the Windows analogue of cron. I can throw off an example of sending mail through VBS, and monitoring a directory is no business at all, there are plenty of examples on the network.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question