A
A
Alexander2018-02-14 16:00:33
Programming
Alexander, 2018-02-14 16:00:33

Program to scan folders and warn about missing file(s)?

There are 50 folders in which a file gets into once an hour, 12 such files are typed in a day. Is it possible to write a program that can check files in folders, and if there is no fresh file, send a warning to the responsible user via, for example, Telegram.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2018-02-14
@SanyaTverskii

Yes, it's possible. Take any scripting language and write a script of several lines.

var fso = new ActiveXObject("Scripting.FileSystemObject")

while(true) {
  tryBackup(filePath + fileName1, filePath + fileName2)
  if (!fso.FileExists(filePath + fileName1)) {
    tryRecover()
  }
  WScript.Sleep(30000)
}
Here's a trashy VBScript example under WSH that checks every 30 seconds for a file and makes a backup.
Similar things can be done on powershell, and on bash scripts, and on almost anything that can work with a disk and a network. Well, fasten another sending to telegrams.

D
Dmitry, 2018-02-14
@Tabletko

Yes. You can write a script based on the same find ./ -type f -cmin 60 -exec {}

A
Alexey, 2018-02-14
@WildHorn

The system is not listed in the question. I have a similar shell script in cron on Linux. True, he simply sends warnings to the mail, but a cursory search shows that Telegram can also be accessed via bash.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question