Shell Command to delete all files other than .cpp files -


i want delete files in directory not .cpp files.

i need command like:

rm except .cpp files 

edit

based on suggestion not parse ls, can loop yourself:

for f in *; if [[ $f != *.cpp ]]; rm "$f"; fi; done 

otherwise, work:

ls | grep -v ".cpp$" | xargs rm 

if want recursively can use:

find . -type f -not -iname "*.cpp" | xargs rm 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -