find all files except e.g. *.xml files in shell

前端 未结 6 1743
天命终不由人
天命终不由人 2021-01-04 07:09

Using bash, how to find files in a directory structure except for *.xml files? I\'m just trying to use

find . -regex ....

regexe:

6条回答
  •  时光说笑
    2021-01-04 07:29

    with bash:

    shopt -s extglob globstar nullglob
    for f in **/*!(.xml); do 
        [[ -d $f ]] && continue
        # do stuff with $f
    done
    

提交回复
热议问题