Mikhail Zabelin
Mikhail Zabelin

Reputation: 23

Bash: how to exclude files with .sh extensions using find?

Good afternoon. My script should find files with the size less than the second argument ($fsize). At the same time it should ignore files with .sh extension. (Actually, it shouldn't find file of the running script. If you prompt me how to realize it, it would me excellent). So could you help me? Here is my vision of this, but it doesn't work.

find -type -f -size -$fsize -and -not -name *.sh  

Upvotes: 0

Views: 335

Answers (1)

michael501
michael501

Reputation: 1482

Try this :

find ./ -type f -size -$fsize -and -not -name '*.sh'

Upvotes: 3

Related Questions