I'm looking at this piece of code for extracting a package:
Code: Select all
extract_pkg() {
PKG=$1
cd /
for x in `cat $D/$PKG`; do [ -d $x ] && MYPATH="$x" || cp --parents -a "${MYPATH}/$x" $WrkDir; done
}
Instead I want to remove the package so I changed that last line to:
Code: Select all
for x in `cat $D/$PKG`; do [ -d $x ] && MYPATH="$x" || rm -r "${MYPATH}/$x"; done
This deletes the files in the top folders and subfolders but now I sit with empty top folders and subfolders that also need to be removed (those applicable to the specific package of course). So how do I do it, adding the -d option does not work.