简体   繁体   中英

How Do I Know Change Directory System Watcher?

How do I change directory folder in system watcher?

I made a desktop app to upload file in database.

I set the root folder as C:\\Users\\x\\Desktop\\Test . A user can copy/paste a file into that folder and that file will upload to database. but sometimes, a user can upload not in that root folder. user can upload file to other folder in root.

Let's say in the root folder, there are folders called Hello and Hallo .. the user clicks on the folder Hello, directory change not C:\\Users\\x\\Desktop\\Test again but C:\\Users\\x\\Desktop\\Test\\Hello

My question, how can I detect it? Because system watcher can only handle created, changed, deleted, renamed. So I must change or create file first to get e.fullpath .

I want that if I click folder Hello , I get e.fullpath :)

Set the IncludeSubdirectories property on your FileSystemWatcher to true, eg:

fsw.IncludeSubdirectories = True

Ref: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.includesubdirectories(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM