How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists

        all the files, directories and sub-directories in the current directory

                                                                        except a folder called log.?

Thank you in advance.

something like

 
find . ! -name log

hmm.. not working.. its displaying all the files in log folder. there are some millions of it.

ls !(log)
1 Like
find . | grep -v "^./log"

Hi elixir,

getting error for your command..

$ ls !(logs)
-bash: !: event not found

$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
1 Like

amazing. worked perfectly.

Turn on extglob ( shopt -s extglob ).

1 Like

worked well. nice.