Add FileWatcher spoon for automatic file organization - #347
Conversation
|
I would do it in a more generic way:
This makes it more extensible and open to additional options in the future: spoon.FileWatcher:watchDirectory("~/Downloads", {
{
PatternMatcher("%.pdf$"),
ActionRenameAs("{currentDate}-*"),
ActionMoveTo("~/Documents/PDFs")
},
{
PatternMatcher("%.png$"),
ActionMoveTo("~/Pictures")
},
}) |
|
That is indeed more flexible, but it is also (probably) harder to understand for simple users that have simple use cases. And, even if we agree, there isn't much interest into merging this spoon anyway. It has been sitting here for an entire year and yours is the first comment about it, so I'm not willing to put any more effort for an potential outcome of being ignored |
|
These matchers and actions can be provided by the FileWatcher, and users can add their own as long as the required interfaces or parameters are available. You are right - fewer PRs are merged in this repo. I also noticed that people publish their spoons in their own repositories (like your https://github.com/danielo515/StreamDeckButton.spoon ), so there is no need to have them in the "main default" repo. |
Yeah, that is too bad. Given that Hammerspoon runs with user permissions and is capable of doing a lot of things, I think that a central repository where the owners audit the code is worth keeping. |
FileWatcher Spoon
This PR adds a new spoon for automatic file organization based on pattern matching rules.
Features
~for home directory)Use Cases
Example Usage
API Documentation
docs.json(generated usinghs -c "hs.doc.builder.genJSON(...)"):init(),:start(),:stop(),:watchDirectory(),:stopWatching(), and:stopAllWatchers()methodsTesting
Tested on macOS with various file types and patterns. Files are moved correctly with proper conflict resolution and notifications.