Announcement

Collapse
No announcement yet.

script help: Monitoring file system for changed file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ksdehoff
    replied
    Thank you very much!

    That is doing exactly what I need - appreciate the bit of help.

    Ken

    Leave a comment:


  • mrhappy
    replied
    Couple of different ways of doing this, if that is a random number generated at the end of the name (I guess the start is YYYYMMDD but don't know the last bit) then there is going to be no way of guessing it. If you take a look at the System.IO.File namespace there are a whole host of different of attributes and things in the directory you could experiment with. This should (providing you change the directory and file search) find if any of the files in the directory have been created this minute.

    Code:
    Sub Main(ByVal Parms As Object)
    
    Dim strFileSize As String = ""
    Dim di As New IO.DirectoryInfo(hs.getapppath & "\scripts\")
    Dim aryFi As IO.FileInfo() = di.GetFiles("*.txt")
    Dim fi As IO.FileInfo
    
    For Each fi In aryFi
    
    	If fi.CreationTime.ToString("dd/MM/yyyy HH:mm") = DateTime.Now.ToString("dd/MM/yyyy HH:mm") Then
    	        hs.writelog("FileInfo", fi.Name & " - was created this minute")
    	Else
    		hs.writelog("FileInfo", "File Not Created Now")
    	End If
    Next
    
    End Sub

    Leave a comment:


  • ksdehoff
    replied
    This is an example:

    image.jpg20120201202109762.jpg

    Leave a comment:


  • jon00
    replied
    You may be able to use Blades BLLatestimage to assist with some of this: http://board.homeseer.com/showthread.php?t=143914

    Leave a comment:


  • mrhappy
    replied
    if you post some examples of the filenames then it should not be too difficult to do...

    Leave a comment:


  • ksdehoff
    started a topic script help: Monitoring file system for changed file

    script help: Monitoring file system for changed file

    All:

    I've got a webcam that is ftping a file to my homeseer server. I'd like to be able to write a job to look at that directory every minute and if a file has been added, email it to myself. The difficulty I'm having is that the file names are different (including a date/time stamp) so I can't just search for 'file.jpg'.

    Does anyone have some vbscript that can get this done? I'd appreciate it.

    Thanks
    Ken
Working...
X