Skip to content
Advertisement

Sort filepaths according to their respective file extensions

I am trying to sort filepaths according to their respective file extensions.

I would like to have an output like this:

FileType FilePath
.h a/b/c/d/xyz.h
.h a/b/c/d/xyz1.h
.class a/b/c/d/xyz.class
.class a/b/c/d/xyz1.class
.jar a/b/c/d/xyz.jar
.jar a/b/c/d/xyz1.jar

But the output I have now is like this: output in excel

Below is my code:

JavaScript

Could anyone please help me with this. Thanks in advance!

Advertisement

Answer

Please try this code:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement