Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detect Newly Created Files (of Specific *.??? 3 letter extention) in VS 2013 C#

Posted on 2013-12-21
2
Medium Priority
?
370 Views
Last Modified: 2013-12-21
Hello!

I need example code in C# that will detect PDF files that are uploaded via Windows file share. (For me, this will be used to detect Acrobat PDF files from a multi-purpose scanner to integrate into a larger management system.)

Please: This should be simple, concise & bug-free Visual Studio 2013 C# code for Windows.

Thank you in advance! Happy Coding! :)
0
Comment
Question by:DumbBoxRox
[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 Comments
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 2000 total points
ID: 39733624
Please: This should be simple, concise & bug-free Visual Studio 2013 C# code for Windows.
Note that Experts Exchange is not a freelance coder website. If you are looking for someone to write a full solution, you would have better success probably at some place like freelancer.com. We will certainly do our best to help, though.

What you are wanting to do is quite easy. The FileSystemWatcher class was designed to do exactly that. Try something like this
using System.IO;
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = "C:\directoryToSearch"; // edit this to the path you want to search
watcher.Filter = "*.pdf"; // find pdfs
watcher.IncludeSubdirectories = true; // also watch subdirectories
watcher.Created += new FileSystemEventHandler(NewFileHandler); // set up the handler
watcher.EnableRaisingEvents = true; //start listening

Open in new window


Then the event handler would look like this

private static void NewFileHandler(object source, FileSystemEventArgs e)
{
    // Do your handling here
   Console.WriteLine("New file seen at: " +  e.FullPath);
}

Open in new window

0
 

Author Closing Comment

by:DumbBoxRox
ID: 39733771
Tommy,

Yes. I was looking just for a snippet, not a full solution. I understand your comment though because of abuse. I have not used the Microsoft .NET API for quite some time, and wanted a professional answer (and you gave me one), so I will reward you with your full amount of points.

Thank you.
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

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Successful collaboration among team members is essential for the growth of your business. When employees work together on projects, share ideas and communicate effectively they get better results.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

715 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