[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Monitor Windows Directory

Posted on 2014-01-29
4
Medium Priority
?
202 Views
Last Modified: 2014-01-30
Hello

I need a bit of advice,  I Have Windows server 2008r2 this runs an ftp service to our partner site. I would the server to email me when they put a file on the system. I have tried watch Dir which works but it cost $79 dollars. is there a better solution?  Could I set up a schedule  task to scan the directory for change? or if a file name has the name test in it?

regards,
0
Comment
Question by:jwc1972
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:p_sie
ID: 39820242
Hi!

Do you need to use VB Classic? If you can also use vb.net (express edition is free) then you can use the FileSystemWatcher control, which can monitor a certain directory for file changes.
You can even use the control in a service.

If you need to use VB Classic, then I think you have to write a function yourself that scans the directories for new files.

p_sie
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 750 total points
ID: 39820307
yes you could create a VB6 function, but you also need to read and update a database (of sorts, could be text file) , so that you know what has changed....

and to do that you will need to use the Scripting.FileSystem object or a windows API call to get the details of all the files currently in the folder.

Are you sure $79 wouldnt be well spent ?

or is the DateModified attribute of the file accurate enough to tell what has changed, in which case you only need to store the DateTime of last check.
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39820322
I no longer have VB6 on my system so this is just a guess.
Sub Test
'add reference to Scripting Runtime	
Dim fso As New FileSystemObject
	Dim fld As Folder
	Dim fil As File
	Set fld = fso.GetFolder("C:\Test")
        dim lastUpdate as Date
        'get lastUpdate from the ini file
        open "myIniFile.ini" for input as #1
           lineinput #1, lastdatetext
        close #1
        lastUpdate = datevalue(lastdatetext) + timevalue(lastdatetext)
        nowdatetext = format(now(),"dd-mmm-yyyy HH:nn:ss")
	For Each fil In fld.Files
  		if fil.DateLastModified > lastUpdate then 
		   AddFileToList fil.Path
                end if
	Next file
        open "myIniFile.ini" for output as #1
           writeline #1, nowdatetext
        close #1

Set fil = Nothing
Set fld = Nothing
Set fso = Nothing


End Sub

Sub AddFileToList(thefilename as string)

  'show the activity

End sub

Open in new window



http://bytes.com/topic/visual-basic/insights/697284-filesystemobject-model-how-list-files-directory-vb6
0
 
LVL 16

Accepted Solution

by:
AlexPace earned 750 total points
ID: 39820768
I agree with robberbaron on this one.  If you can solve the problem for $79 just do it.   Assuming you are a software industry professional that $79 is less than it costs your employer for one hour of your time.  I used to make that mistake all the time.... I think I justified it to myself by "saving money" but I think the truth of the matter is that I have a need to understand and solve problems and this was getting in the way of my rational thinking.  

Anyway, to put this post at least somewhere near the topic ... I would solve this problem with Robo-FTP and that costs $150.... but it was basically designed for FTP automation so you can do stuff like make an automatic retry loop for the file transfer and then have the Robo script itself send the email as soon as the remote server acknowledges successful transmission... fewer moving parts that way and the best part (at least for my employer) is that the software is supported by a 3rd party company so they are not dependant on me continuing to work for them.  YMMV.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question