Tools for monitoring files in a folder

Hi,
I want to monitor a folder for files and alert if we dont get a file for some time.

Thanks,
Ravi
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAsked:
Who is Participating?
 
RobConnect With a Mentor Owner (Aidellio)Commented:
A simple script should do it that can be scheduled to run as often as you need to test.

this is vb script, assuming windows platform:

Set wshShell = CreateObject( "WScript.Shell" )
Set wshSystemEnv = wshShell.Environment( "SYSTEM" )

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\FSO")
Set colFiles = objFolder.Files

' Display the current value
If wshSystemEnv( "FileCount" ) = colFiles.Count Then
' Display an ALERT
Else
' Set the environment variable
wshSystemEnv( "FileCount" ) = colFiles.Count

End If

Open in new window

0
 
RobOwner (Aidellio)Commented:
Windows platform?
Will any of the files be overwritten? meaning the modified date of the file would need to be checked?
0
 
SurranoConnect With a Mentor System EngineerCommented:
Depending on the use case it may become quite complex.
Below is a unix (bash) shell solution that assumes
- a file modification timestamp is in accordance with its appearance in the directory.
- a changed file is considered "new"
- only regular files (not directories, FIFOs, symlinks, block devices, etc) are checked

#!/bin/bash

# seconds to sleep
SLEEP=60
# directory to monitor
DIR=~/incoming
# 
BASELINE="/var/run/incoming.baseline"

# establish baseline
touch "$BASELINE"

while true; do
  sleep $SLEEP
  touch "${BASELINE}.tmp"
  newfile=`find "$DIR" -type f -newer "$BASELINE" | head -1`
  mv "${BASELINE}.tmp" "$BASELINE"
  if [ "$newfile" = "" ]; then
    # do the alerting of your choice
  fi
done

Open in new window

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAuthor Commented:
Hi,

All the files will be over written if not processed by a job.

Thanks,
Ravi
0
 
RobOwner (Aidellio)Commented:
What platform are you running on?
0
 
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAuthor Commented:
Windows server  platform
0
 
RobOwner (Aidellio)Commented:
Did you try any of the scripts posted above?
0
 
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAuthor Commented:
I am not a expert in scripting. I am looking for tools with user interface and easy to use. It can be open source or commercial one.
0
 
RobConnect With a Mentor Owner (Aidellio)Commented:
Sorry I haven't used any of the following ,but the first link is a review of the top 10 tools to monitor files.

http://www.raymond.cc/blog/3-portable-tools-monitor-files-folders-changes/

"Watch 4 folder" Comes up a lot and well recommended. There is a free Version but it will only monitor one folder. Claims to capture up to 12 or 13 events but to not overload your system l would only start with the events you're most in need of .
http://leelusoft.blogspot.com.au/p/watch-4-folder-25.html

Rob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.