简体   繁体   中英

How to find “last modified time” of a folder in java

I want to continuously monitor a folder (say C:/Users/me/csv) for any change in its content -

  1. either new files added, or (sub-folder changes doesn't bother me as of now)
  2. existing file modified

If either of two happens, what is 'the parameter of csv folder' which gets modified? (anything like timestamp which I can compare with previous value of that parameter and trigger loading the csv data again to my collection)

I thought this was the reason WatchService was added to JDK 7:

http://docs.oracle.com/javase/tutorial/essential/io/notification.html

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