Moving a folder after a time of inactivity lazarus / 34-Windows ---------------------------------------------------------------------- sblisesivdin · 2020-03-23 10:36 Hello dear all, I am trying to write a small program controlling my scientific calculations. I can add, copy remove files and folders with controlling many things. However, I need to control a folder with files and when any of the files are not accessed (mostly accessed for writing) for a while (for example 30mins) I want to move the files to another folder. The thing is how can I filter the folder for inactivity? ---------------------------------------------------------------------- balazsszekely · 2020-03-23 10:58 @sblisesivdin Create a hash list with all the files in the folder, when a particular file changes the hash will also change. All you have to do is compare two hash lists from time to time. Use the TFPHashList from contnrs. ---------------------------------------------------------------------- sblisesivdin · 2020-03-23 11:27 Thank you for this very good idea. I stuck with classical folder operations and this is what I am searching for. ---------------------------------------------------------------------- dbannon · 2020-03-23 11:33 sblisesivdin,  I note you say "mostly accessed for writing", if that "mostly" means you also need to be aware of another process reading, its a bit hard. Reading won't change the hash for example. Important question - what operating system are you using ?  On linux, you can check the atime of all the files, would be a very fast process, that would tell you if the files had been written to or read.  On almost all systems, atime is enabled by default.  I expect (but don't know for sure) that MacOS will also provide atime. I am no windows expert but I believe NTFS does not offer atime.  Almost impossible to tell if the file has been read.  I think.... Davo ---------------------------------------------------------------------- balazsszekely · 2020-03-23 11:40 QuoteThank you for this very good idea. I stuck with classical folder operations and this is what I am searching for.Once a forum user asked for an application which compares two folders, then list the same files. I know it's not exactly what are you after, but is not to different either. Please download and test attached project. ---------------------------------------------------------------------- dbannon · 2020-03-23 11:48 Actually, looks like I am wrong, NTFS does have an atime attribute now. Reading that attribute would be a lot faster than reading all of all the files to generate a hash. Davo ---------------------------------------------------------------------- ASerge · 2020-03-23 20:02 Quote from: sblisesivdin on March 23, 2020, 11:36:31 amHello dear all, I am trying to write a small program controlling my scientific calculations. I can add, copy remove files and folders with controlling many things. However, I need to control a folder with files and when any of the files are not accessed (mostly accessed for writing) for a while (for example 30mins) I want to move the files to another folder. The thing is how can I filter the folder for inactivity? See Watching a folder for changes with DirWatch.