Announcement

Collapse
No announcement yet.

Number of files counter

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

    Number of files counter

    Hi All,
    I'm looking for a simple script that can count the number of files on a remote folder and put this a in device.

    I hope there are good examples.


    Thanks,
    Enver

    #2
    Here is a try to give concept, but I' at kiosk so cannot check. It goes as event to run single line script. &hs.setdevicestring "a1", createobject("scripting.filesystemobject").getfolder("\\comp uter\c\folder").files.count

    Comment


      #3
      You could take a look at this script http://board.homeseer.com/showthread.php?t=128342. It counts the number of files in a directory and could be eaisly modified to post the number of files to a device.
      Billy

      Comment


        #4
        This is VB.NET

        Code:
        Dim files As String()
        Dim numFiles as integer
        dim dir as string = "C:/"
        
        try
        files = System.IO.Directory.GetFiles(dir, "*")
        catch e as exception
        msgbox("error=" & e.ToString())
        end try
        
        numFiles = files.length - 1

        Comment


          #5
          Or as a one liner in a vb.net script
          Dim iFileCount As Integer = System.IO.Directory.GetFiles("c:\temp").Length
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            Thanks.
            This one works okay..
            I will test also the rest.

            Idea is to count the number of voice mails on my answering machine (FritzBox)
            Playback will be later..I need first to convert the files.


            Originally posted by Michael McSharry View Post
            Here is a try to give concept, but I' at kiosk so cannot check. It goes as event to run single line script. &hs.setdevicestring "a1", createobject("scripting.filesystemobject").getfolder("\\comp uter\c\folder").files.count

            Comment


              #7
              Chak,
              If you don't want a script you add a "dimming" virtual Device to HS and an Event to count up(a "bright 1%" action in the event) if you can trigger the event when a VM comes in. The limit of course is 0 to 100 counts. To reset ("Dim 100%) or count down("Dim 1%).
              BobSpen

              Comment


                #8
                There is no option to count the VM
                I have to do it after every disconnect.

                This I what I'm doing

                For HSTouch
                &hs.setdevicestring "v99", createobject("scripting.filesystemobject").getfolder("V:\"). files.count

                For Homeseer device view
                &hs.setdevicevalue "v99", createobject("scripting.filesystemobject").getfolder("V:\"). files.count

                Can I combine them in one script?

                Comment

                Working...
                X