gcc

shell script which lists the subdirectories of current directory

Asked by anasgeorg

I want to create a shell script which lists the subdirectories of the current directory.
What i must use?

Also i want to create a script that finds the files with a "given" pattern and deletes them.The search starts from the current directory and continues with directories at lower level.
It is correct to use :
"find . -name "*.*" -exec grep -l -n "test" {} \; | xargs rm
Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
gcc Edit question
Assignee:
No assignee Edit question
Solved by:
anasgeorg
Solved:
Last query:
Last reply:
Revision history for this message
Randy LeJeune (lejeunerandy-fastmail) said :
#1

The "tree" command will do the first for you.

Revision history for this message
anasgeorg (anasgeorg) said :
#2

i give the command tree at a terminal and gives me a message "bash: tree: command not found"
Can you give me some more details.
Thank you

Revision history for this message
Randy LeJeune (lejeunerandy-fastmail) said :
#3

Try this:

sudo apt-get install tree

This should install tghe "tree program" . . . it gives you a graphical "tree" of your directories and subdirectories.

Revision history for this message
anasgeorg (anasgeorg) said :
#4

thanks you.its okay.

Revision history for this message
wouter bolsterlee (wbolster) said :
#5

Or just find . -type d