Created
April 1, 2019 15:31
-
-
Save obsergiu/eef848b7fa27f9877b7020c056a039c9 to your computer and use it in GitHub Desktop.
Revisions
-
obsergiu created this gist
Apr 1, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/usr/bin/env bash # Old approach - working but # the bash approach offers # greater mobility #GLOBIGNORE=$(paste -s -d : ./config/ignore.list) #rm -Rf -- {*,.*} # new line is mandatory as allows # to skip substrings newline=' ' # load the project default files ignore_list="$newline$(cat ./config/ignore.list)$newline" # the ignore.list file would have the files one on a line, eg: # file1.ext # dir1 # file2.ext # ... # echoes the files/directory on first level # without going recursively # and removes them for x in * .[!.]* ..?*; do case "$x" in *"$newline"*) continue;; esac # sanity check: if the file name contains a newline, leave it alone case "$ignore_list" in *"$newline$x$newline"*) echo "Skipping $x";; *) echo "Delete: $x" && rm -rf -- "$x"; esac done