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. }
Comments
Post a Comment