I am trying to write a very simple Bash shell script that will cd in a specific directory, it will remove all files and directories except some few selected ones and then cd
Try below:
for i in `ls | grep -v "file1\|file2\|file3"` ; do rm -rf $i; done
Good Luck!