i run the following command line to remove all files/dirs in directory :
cd /home/abdennour/android/
rm -rf *
the architecture of this directory is as following :
/home/abdennour/android/
/home/abdennour/android/documents/
/home/abdennour/android/documents/medialib/
/home/abdennour/android/documents/preview/
/home/abdennour/android/fixtures/
/home/abdennour/android/images/
/home/abdennour/android/images/hard/
/home/abdennour/android/images/mlibrary/
/home/abdennour/android/images/mlibrary/thumbs/
/home/abdennour/android/js/
.....
i want to remove all with excluding the following directories :
/home/abdennour/android/documents/
/home/abdennour/android/images/mlibrary/
You can use
GLOBIGNORE
environment variable. Suppose that you want to delete everithing except/home/abdennour/android/documents/
and/home/abdennour/android/images/mlibrary/
, then you can do the following:As the list of those dirs you don't want to remove is pretty short and it doesn't seem to fit any obvious pattern, I think you will just have to move those dirs somewhere prior to deleting the rest.