dotfiles/config/nix/scripts/dummy
Geoffrey Frogeye 1f61ceb395
nix: Migrate scripts
They're a bit slower to start :(.
Hopefully this is something that flakes will help with,
otherwise I'll find another way.
2023-11-26 21:04:58 +01:00

17 lines
382 B
Plaintext
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p bash tree coreutils
# Remplace le contenu d'un dossier par un fichier texte
# relatant son arborescense
dir="$(echo "$1" | sed 's|/\+||')"
if [ -d "$dir" ]; then
TEMP=$(mktemp)
tree -a -p -D -n "$dir" > "$TEMP"
mv "$dir" "$dir.bkp"
mv "$TEMP" "$dir"
else
echo "$dir n'est pas un dossier"
fi