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
Post a Comment