M
M
Misteor2021-02-21 19:50:28
Data synchronization
Misteor, 2021-02-21 19:50:28

How to check folders for new files or changes and get alerts?

It is necessary that an alert be sent if new files appear in the directory.
There are many programs that do this in real time, but changes can be made when the computer is turned off or by other users, or they can be on the server. Therefore, we need a program that will, for example, when the computer is turned on or once an hour, check the selected directories and notify if something has changed since the last check.
It seems to be useful and does not look difficult, but I could not find a solution.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
antonwx, 2021-02-21
@antonwx

Actually, the task is quite simply solved with the help of such a batch file:

@echo off
dir target_folder /b /s >newdir.txt
fc /b olddir.txt newdir.txt > nul
if errorlevel 1 (
    echo different
) else (
    echo same
)
del olddir.txt
rename newdir.txt olddir.txt
pause

Instead of echo different and echo same, respectively, you need to insert the launch of the notification program or the call to the php script using wget. The script will work if a new file is created, the old one is deleted or renamed, but there will be no reaction to changing the contents.
"once an hour" or "when the computer is turned on" - you can configure this using the windows task scheduler

J
John Smith, 2021-02-21
@ClearAirTurbulence

Once there was a similar question. There are many programs that do this. Googles easily.
https://www.google.com/search?q=program+to+watch+n...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question