Wednesday, July 10, 2013

How to delete files without extentions

بسم الله
رمضان كريم

This the following is a oneliner to delete all files without extensions in the current directory:-

ls | grep -v "\." | xargs rm


What it does is basically to list all files using ls and then filter the non-extension files with grep.And then pass all those files to rm through xargs.


or if you prefer to use find

find . ! -name "*.*" -exec rm '{}' \;

The above command is simply to find files without extensions and ask find to delete them

الله أعلم


No comments:

Post a Comment