✅ Does `FileSystemWatcher` work on linux? (Trying to monitor for files being added or renamed)
Hi. Im trying to monitor a directory for any files being added to it or renamed. I found FileSystemWatcher but the platform support is unclear. I suspect it does not work on linux because many of the events don't make sense on linux (e.g. how would LastWrite work when files arent locked on linux)
Does this work on linux? if not what should I use instead?
19 Replies
$tias I guess?
The docs don't mention anything about it not working on Linux for what it's worth
It works
just didnt want to write a bunch of code to handle the file and have it work on my windows laptop, only to deploy it to my server and find out it doesnt actually work lol
just works? does it just not fire LastWrite then?
Though many linux systems have a lower number of inotify instances
What do you think
LastWrite
means?I assumed it fired when the file was unlocked
No
It fires when the last written time changes
When that happens is OS-dependent
ohhhhh
an article i was reading suggesting watching for LastWrite to avoid picking up files that arent done being written to yet
It doesn't mean "the last write has occurred", if that's what you were thinking 🙂
I mean, that might certainly work
yeah, the article suggested using it as such so i assumed it meant "the last write has occured"
maybe ill just handle this firefox style and add
.part
to files until they're done being written and it can just ignore any .part
filesBut more because that's when the OS considers the file content to have been flushed to disk
Both firefox and chrome do that
then I don't have to worry about nuances in when the OS considers it "done" and such
Though chrome uses a different ext
ah interesting, i dont use chrome much lol
thank you
yw
this was very helpful i appreciate it
Don't forget to $close if there are no more questions
Use the
/close
command to mark a forum thread as answered