filecount-api
Stupid simple REST API to list count of files with specified extension in specified directories.
This does not include any error handling and security stuff, so please don't actually use this for any public-available endpoints. I've created this small tool to monitor some directory sizes and display them in my HomeAssistant instance.
How to run
- Build with Go
go build
- Create
filecount-api-config.json
(see example below) - Run
filecount-api [PORT]
- Consume
http://localhost:[PORT]
Example config
{
"Directories": [
{
"Path": "/var/www/foo",
"Extension": ".xml",
"FriendlyName": "foo"
},
{
"Path": "/var/www/foo/bar",
"Extension": ".xml",
"FriendlyName": "bar"
}
]
}
Example response
{
"DirectoriesCounts": {
"foo": {
"Count": 2
},
"bar": {
"Count": 3
}
}
}