문제

I have a folder which contains some extension of file, I want to remove all but html extension. Can any one help me?

도움이 되었습니까?

해결책

Use bash's extglob feature. To enable it, if it's not already on:

shopt -s extglob

Then you can simply negate the glob:

rm !(*.html)

다른 팁

You can use this find command:

find /your/path -maxdepth 1 -type f ! -name '*.html' -delete
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top