Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:50:38+00:00 2026-06-14T19:50:38+00:00

I have been asked to create a console application which polls an active Directory.

  • 0

I have been asked to create a console application which polls an active Directory. (C.\Temp\Input)

When a file comes in with (filename).SUCCESS, filename is retrieve in order to run a SQL query. So

IF fileextension = SUCCESS

Runs SQL Query using filename to change a value in the SQL Table.
Moves Original file to c:\temp\Input\Processed

Any help or hints would be much appreciated.

UPDATED:

Hi, With a few looks at various sites iv come up with the below. Forgetting the SQL for now, im only after the Filename and the moving of files but im getting an IO Exception that the file is already in use:

Imports System.IO
Imports System.String
Module Module1

Dim fileName As String = "C:\temp\Input\NR12345.success"
Dim pathname As String = "C:\temp\Input\"
Dim result As String
Dim sourceDir As String = "C:\temp\Input\"
Dim processedDir As String = "C:\temp\Input\Processed\"
Dim fList As String() = Directory.GetFiles(sourceDir, "*.success")



Sub Main()
    result = Path.GetFileName(fileName)
    Console.WriteLine("GetFileName('{0}') returns '{1}'", fileName, result)
    result = Path.GetFileName(pathname)
    Console.WriteLine("GetFileName('{0}') returns '{1}'", pathname, result)

    Call MySub()

End Sub

Sub MySub()
    'Move Files

    For Each f As String In fList
        'Remove path from the file name. 
        Dim fName As String = f.Substring(sourceDir.Length = 0)
        Dim sourceFile = Path.Combine(sourceDir, fName)
        Dim processedFileDir = Path.Combine(processedDir, fName)

        ' Use the Path.Combine method to safely append the file name to the path. 
        ' Will overwrite if the destination file already exists.
        File.Copy(Path.Combine(sourceDir, fName), Path.Combine(processedDir, fName), True)
        'File.Copy(sourceFile, processedFileDir)

    Next f
End Sub

End Module

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:50:39+00:00Added an answer on June 14, 2026 at 7:50 pm

    I’ve used this before:

    The FileWather Class

    Really useful for polling directories for changes in structure and file details etc.

    You can then use this to get an extension of a file and, if it meets your criteria, perform some actions.

    These links come with examples so enjoy!!

    Sub MySub()
        'Move Files
    
        For Each f As String In fList
    
            Dim fInfo As FileInfo = New FileInfo(f)
    
            Dim fName As String = fInfo.Name
    
            Dim processedFileDir = Path.Combine(processedDir, fName)
    
            ' Use the Path.Combine method to safely append the file name to the path. 
            ' Will overwrite if the destination file already exists.
            File.Copy(fInfo.FullName, processedFileDir, True)
    
        Next f
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been asked to create some functionality in which marketing team send users
I have been asked to create import functionality in my application. I am getting
I have been asked to create a sandboxed SharePoint application/site; multiple developers will be
I have been asked to create a project in vb.net which needs to integrate
I have been asked to create a vbscript that will set the default font
I am new to web programming...I have been asked to create a simple Internet
For a project I am working on, I have been asked to create an
I have been asked to improve the memory efficiency of an application that is
I have been asked by my supervisor to develop a web application using either
I have been asked to create a graphical programming IDE for embedded 8-bit and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.