delete multiple files/directory with exclusion
I have multiple files in a directory and I was logged in thru my bash shell. Then I just issue the command below.
rm -rf $(ls|grep -E '[^(^ext$)|(mootools)]')
grep -E will execute an extended regular expression so ext and mootools will be retain or excluded upon deletion of files in the current directory.
rm -rf $(ls|grep -E '[^(^ext$)|(mootools)]')
grep -E will execute an extended regular expression so ext and mootools will be retain or excluded upon deletion of files in the current directory.
Comments