RuiT
RuiT

Reputation: 33

New file in folder

I want to detect when a new file is added to a existing folder and access it.

How can I do this (C#)?

Thanks

Upvotes: 3

Views: 2791

Answers (5)

magnus
magnus

Reputation: 653

Use the FileSystemWatcher class wich raises events when a file is created, updated etc.

FileSystemWatcher

Upvotes: 1

user59634
user59634

Reputation:

I am not a Windows dude, but generally speaking, find out if there is a Windows API call which allows you to watch a directory.

Upvotes: 0

Christian V
Christian V

Reputation: 2040

Using the FileSystemWatcher class

Upvotes: 1

Michał Ziober
Michał Ziober

Reputation: 38655

See FileSystemWatcher

  1. Tutorial 1
  2. Tutorial 2

Upvotes: 10

Atmocreations
Atmocreations

Reputation: 10061

You should take a look at System.IO.FileSystemWatcher, this is the class you might want to use.

Upvotes: 3

Related Questions