CDIST-TYPE__CLEAN_PATH(7)
π cdist-type__clean_path β the manual page, but make it make sense π
okay bestie, welcome to cdist-type__clean_path(7) β yes that's the whole manual name, it's giving very β¨ official β¨. this is the type you call when a directory has collected stray files like a group chat collects unread messages and you just need them gone. π§Ήβ¨
πΈ NAME πΈ
cdist-type__clean_path β remove files and directories which match the pattern.
β¨ DESCRIPTION β¨
so basically: remove files and directories which match the pattern. that's the whole vibe. π
a few things you absolutely need to know before you start deleting stuff, no cap:
- the provided path must be a directory. like, fr, it has to be a dir.
- patterns get passed straight to
find's-regexβ go readfind(1)for the deets, iykyk. - the lookup of files and directories is non-recursive (
-maxdepth 1), so it only looks at the top level, not the whole tree. - the parent directory is excluded (
-mindepth 1), so you're not nuking the dir itself. π«Ά - this type is not POSIX compatible β sorry, Solaris users π (genuinely sorry tho).
π REQUIRED PARAMETERS π
patternβ pattern of files which are removed from path. mandatory, babes. no pattern, no cleanup.
π OPTIONAL PARAMETERS π
pathβ path which will be cleaned. defaults to$__object_id, so if you don't say anything it just uses that. iconic default behaviour honestly.excludeβ pattern of files which are excluded from removal. the VIP list. the ones who get to stay. π¦onchangeβ the code to run if files or directories were removed. like, if something actually got deleted, then do this thing. main character energy. π₯
π EXAMPLES π
here's the glow-up in action β first one uses the path directly, second one uses an object id and passes --path explicitly. both slay:
__clean_path /etc/apache2/conf-enabled \
--pattern '.+' \
--exclude '.+\(charset\.conf\|security\.conf\)' \
--onchange 'service apache2 restart'
__clean_path apache2-conf-enabled \
--path /etc/apache2/conf-enabled \
--pattern '.+' \
--exclude '.+\(charset\.conf\|security\.conf\)' \
--onchange 'service apache2 restart'
see how --exclude keeps charset.conf and security.conf safe while everything else in that dir gets yeeted and apache gets restarted? that's the whole trick. β
careful bestie β--pattern '.+'matches basically everything, so double-check your--excludebefore you run this on anything that matters. π
π AUTHORS π
Ander Punnar <ander-at-kvlt-dot-ee>
π COPYING π
Copyright (C) 2019 Ander Punnar. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
π COPYRIGHT π
ungleich GmbH 2021
and that's the whole page, bestie. π this was cdist-type__clean_path, manual version 7.0.0, dated Jul 31, 2022, brought to you by cdist itself. go forth and clean those paths responsibly. mwah. π
β¨
π¦ where this page comes from
- fedora 43: cdist 7.0.0-16.fc43 Β· GPL-3.0-only
- fedora 44: cdist 7.0.0-18.fc44 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms