Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 18th, 2008, 05:42 AM
Newbie
 
Join Date: Aug 2008
Posts: 23
Default Listing Directory Recursively

Hi

I want list all files on all directory recursively.As example below,

/home/ashok>ls -1p
test.txt
test1.txt
directory1/
directory2/

/home/ashok> cd directory1/
ashok/directory1>ls -1p
a1.txt
a2.txt

ashok/directory1>cd ../directory2/
ashok/directory2>ls -1p
b1.txt
b2.txt


The above is the directory structure from home directory.
I want to display like this below from /home/ashok>
listing:::

test.txt
test1.txt
directory1/a1.txt
directory1/a2.txt
directory2/b1.txt
directory2/b2.txt

How do i do that.

Thanks in advance.Any suggestion is highly appriciated.

-Ashok
Reply
  #2  
Old August 18th, 2008, 08:02 AM
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 297
Default

try with 'find' command

find . -print

NOTE:There is dot after find command....
Reply
  #3  
Old August 18th, 2008, 09:58 AM
Newbie
 
Join Date: Aug 2008
Posts: 23
Default

It is exactely what i am expecting but the first entry is giving "."
I want all files under current and all child directories not any directory entry in the listing.But the first entry is a directory "."

Can you please suggest how do i remove the first entry.

-Ashok
Reply
  #4  
Old August 18th, 2008, 10:23 AM
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 297
Default

Quote:
Originally Posted by ashokd001
It is exactely what i am expecting but the first entry is giving "."
I want all files under current and all child directories not any directory entry in the listing.But the first entry is a directory "."

Can you please suggest how do i remove the first entry.

-Ashok
Try this command..It will give you the list of files only...
all directory entries will be excluded..
find . -type f -print
Reply
  #5  
Old August 18th, 2008, 11:55 AM
Newbie
 
Join Date: Aug 2008
Posts: 23
Default

Really great....
Thanks a lot..
-Ashok
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles