c# - How do you get the name of a new file created using FileSystemWatcher? -


i'm monitoring folder using filesystemwatcher. if download file there, how name of downloaded file? example, if downloaded file named textfile.txt, how have return string? assuming work 4 triggers (changed, created, deleted, renamed)? have includesubdirectories set true, should able that.

on oncreated event, add code:

private void watcher_oncreated(object source, filesystemeventargs e) {     fileinfo file = new fileinfo(e.fullpath);     console.writeline(file.name); // you're looking for. } 

see fileinfo class @ msdn


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -