Frage

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

War es hilfreich?

Lösung

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)

Andere Tipps

You can use this find command:

find /your/path -maxdepth 1 -type f ! -name '*.html' -delete
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top