[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

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
0
Ravi Kiran Reddy Katkuri
Asked:
Ravi Kiran Reddy Katkuri
  • 5
  • 3
3 Solutions
 
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
 
RobOwner (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
 
SurranoSystem 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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
RobOwner (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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now